Questions tagged as 'sql-server'

0
answers

How to use @sqlstatement in SQL Server [closed]

How can I make a better use of the @sqlstatement variable in SQL Server, I could not understand what its real function is. Please, could you explain and leave some examples? I ask that if possible do not use the image because I am visually...
asked by 10.10.2014 / 14:23
0
answers

What are the means of replicating tables between SQL servers?

When developing a project, I came across the following situation: We have a system where users enter information in the course of the production process, and in the end a report is generated. This data is saved to an in-house SQL Server se...
asked by 18.07.2017 / 13:30
1
answer

Query union, group by and count in same query filtering by date range

I'm not making progress on creating a query that can have UNION, GROUP BY, and COUNT based on a date range in the same query. To achieve my goal, I need the following actions in the same query: 1st) filter, group and count all customer reques...
asked by 06.09.2015 / 01:44
2
answers

How can I count fields that are NULL?

I'm using this query: I would like to know how I can count these fields that have no records. Here it returns 0. But I have some null records. What do I do? SELECT DataFim, COUNT(DataFim) AS QTD FROM AtivacaoGuincho GROUP BY DataFim HAVING Dat...
asked by 26.01.2017 / 18:00
4
answers

Find the best-selling item together with a certain item [duplicate]

To explain, I prefer an example: I want to find out which item is best sold along with salted chicken. For this, I tried the following approach and failed miserably due to lack of technical knowledge: -Find all coupons (sales) that...
asked by 04.08.2017 / 07:06
2
answers

How to concatenate two Data?

How to concatenate two dates of type DateTime , one of which may have its value equal to NULL , I'm trying as follows; DECLARE @DATA1 DATETIME = GETDATE(), @DATA2 DATETIME select Convert(nvarchar(50),@DATA1 , 121) +'|'+ Convert(n...
asked by 25.07.2016 / 15:17
4
answers

What kind of data to use for sale ID

I have a Windows Form application developed in C # and with SQL database. One of the functions of the system is to carry out SALES for different companies and different POS (different point of sale), however, using a single database. I use ID...
asked by 18.10.2016 / 13:43
2
answers

Rebuild tables without dropping

I have a table already populated. In it there is a not null field, which I need to set to null. In graphical mode does not accept and says that I have to re-create the table. Is there any way I can do this without having to drop the table and st...
asked by 04.02.2015 / 13:28
2
answers

Changing the order of the Sql columns?

Good morning Could you instruct me to change the order of the columns in a table? Example: I have Table IcmsMvaUF in the following order: I'd like to pass the MvaEmpresa column to the first column on the left side of the...
asked by 25.05.2017 / 16:38
2
answers

Bank objects as Stored Procedure parameters

Why do not we accept bank objects as parameters in a stored procedure? Ex: @COLUNA nvarchar(30), @VARIAVEL nvarchar(50) SELECT * FROM TBL_TESTE WHERE @COLUNA = @VARIAVEL The only alternative would be dynamic queries?     
asked by 27.06.2016 / 16:41