Questions tagged as 'tsql'

0
answers

Problems with OPENROWSET in SQL Server 2016 Express (64bit)

Good morning, I'm trying to read an Excel .xls file by the OLEDB driver used in SQL Server for integrations with Microsoft.ACE.OLEDB.12.0 files in SQL Server 2016 Express (64bit). Using the command OPENROWSET but I'm getting the famous er...
asked by 02.03.2018 / 14:57
0
answers

Compare values of two tables in a Procedure

I have an application that lists in a grid files that are registered in the table    SCF_Process Documentation However, now I need to list only if this file also exists in the table    SCF_ARQUIVO_UPLOAD What the application does i...
asked by 24.01.2018 / 19:29
2
answers

Procedure delete join between tables

Good afternoon, I have the following Tb.Customer environment where a client has N processes in Tb.Process, N moves in Tb.Andamento, and N attachments in Tb.Annexo. Ineedtomountansqlstatementthatdeletesaclientbythecode" ClienteID ", del...
asked by 05.12.2017 / 17:11
1
answer

Error trying to create a Proc in the database

I'm trying to run a Stored Procedure in the database and it's giving this message:    Can not grant, deny, or revoke permissions to sa, dbo, entity owner,   information_schema, sys, or yourself How do I resolve this? If Proc already ex...
asked by 17.04.2017 / 21:36
1
answer

I need to display a TOTAL field in a PIVOT query

I have the query below that returns the total quantity in stock of the products for each city. Each city is a column and the products are displayed in rows. Now I need to display in a field (column) the sum of the total quantity of each city,...
asked by 15.02.2017 / 17:54
2
answers

Order by or filter in join Sql Server

You can use order by or some filter in inner join or left join or I'm trying to do this in the wrong way. I need to bring in a query a column that is in a daughter table, but I need to be the most recent record column of the daughter table recor...
asked by 30.07.2016 / 16:49
1
answer

INSTEAD OF (Deleted table)

I'm having trouble creating this trigger: CREATE TRIGGER TGmonitoraClientes ON TB_CLIENTES INSTEAD OF DELETE AS BEGIN UPDATE TB_CLIENTES SET clienteAtivo = 0 FROM TB_CLIENTES WHERE CODcliente = deleted.CODcliente INSERT INTO LogClie...
asked by 20.10.2016 / 19:51
1
answer

How to know how many sales for each of the months?

I need to set up a query that brings the total sales of each month from a table called sales.SalesOrderHeader , but I'm not getting it. In this table there is a field OrderDate which is the date of sale and TotalDue is the va...
asked by 14.08.2017 / 19:34