Questions tagged as 'sql-server'

1
answer

How to perform an arithmetic operation without sorting it in GROUP BY

Having the following SELECT querying a PivotTable from a subselect, I get the result of the query correctly however with records divided into the following example: cod_representante | ... | VALOR_TOTAL_MERCEARIA | VALOR_TOTAL_PC_MP 123...
asked by 01.12.2015 / 18:35
1
answer

SQL Server 2012, error executing query

Good afternoon, people When you run the query below: select PRO_Descricao, PED_Numero from pedido p, item i, produto pr where p.PED_Numero = i.PED_Numero and i.PRO_Codigo = pr.PRO_Codigo and PRO_Descricao >= 'SA' and pro_descricao < '...
asked by 29.10.2015 / 21:22
4
answers

If no where condition SQL Server

I have a Stored Procedure where I need to do a check for a date filter, if the start date is null I have to do in WHERE to get all records smaller than the end date, otherwise I make BETWEEN between dates. Example If...
asked by 15.11.2018 / 12:26
1
answer

How do I select multiple fields in the same query?

I created a dummy bank with the following structure: BelowarealsothenumberedSQLServerscriptsforcreatingthedatabase,ifneeded. SQL Fiddle Now, what I want is to make a query where they are shown: The limit of an additional holder - pre...
asked by 05.09.2015 / 22:00
1
answer

Remote Connection, C # with SQL Server (2008)

I'm new to C #, and I'm trying to connect my C # application remotely with a SQL Server database that is on another PC (the PC is not on the same network, it's my friend's), but it is giving error. A before they say that I have already set up th...
asked by 07.07.2015 / 01:07
3
answers

Return the Id of table 1 and insert in table 2 in the same code

Next, talk with 2 tables (Group1 and Group2), so I have a form that has several fields that will be inserted at the same time in these 2 tables. But I need to insert into the Group2 table the Id of the Group1 table that was just generated in tha...
asked by 15.03.2016 / 15:32
1
answer

Incorrect information when loading bigdecimal entity

I have a table, that one of its columns is a numeric (25,10) that will be shown rates. But there are records that will be reset (0.0000000000) In my entity you have ownership of this fee, such as a BigDecimal . But when hibernate populat...
asked by 04.08.2015 / 22:28
1
answer

Junction of SQL SERVER Selects

I have the following selects, but I need to be returned that data together, joining the selects does anyone suggest something? SELECT COUNT(numero_parcela) as 'total_parcelas', SUM(valor_original) as 'valor_original', SUM(valor_pago) as 'val...
asked by 28.01.2016 / 00:03
1
answer

Problems with NOLOCK, READ COMMITTED SNAPSHOT

I always see sqls mounted with WITH NOLOCK that say improve performance, but I also heard that NOLOCK is obsolete and what should be used now is READ COMMITTED SNAPSHOT, in this scenario my doubts are: 1 - NOLOCK even improves performance or...
asked by 10.01.2015 / 03:52
1
answer

Problem when storing decimal values in SQL Server

I have a decimal field (18, 3) and in the application I use a JavaScript plugin to format the values entered, so I pass the value so pro SQL Server 45,000,000,000, when I look at what was registered was this 45000000000.000, or I mean, he put 3...
asked by 26.11.2014 / 17:29