Questions tagged as 'sql-server'

1
answer

How to only bring records that have no association in the second table?

I have a query that returns the number of phones registered in each state, country and also brings the number of clients that do not have a telephone number registered in each state, but parents would like to bring only those clients that do not...
asked by 22.09.2014 / 21:06
2
answers

How to execute query in C # for request control

I'm new to programming and need to add some functionality in a C # asp.net application. One is a control that prevents the user from proceeding with the request if it has any pending on the system. I'll describe it step by step. My view @us...
asked by 11.09.2014 / 21:45
2
answers

Query returns "Invalid column name 'result'. "Where 'result' is a column generated by select (SQL SERVER) [closed]

SELECT cte, (CONVERT(VARCHAR, manifesto) + ' ' + TIPO) as result FROM coleta WHERE result = '567 TRUCK SIDER'     
asked by 08.11.2018 / 16:11
1
answer

Select with PIVOT always returns null

I'm trying to make a query using the pivot based on this link insert the description of the link here , but without success, because it always returns 2 lines Null: Query: DECLARE @registros as table ( ID int, Campo varchar(250),...
asked by 18.10.2018 / 00:06
1
answer

How to sum values in sql in column

I have the following sql code: select PS.PatSldBemValResidAnt ,PS.PatSldBemValDepAcum ,Sum(PS.PatSldBemValDep) PatSldBemValDep ,Sum(PS.PatSldBemValResid) PatSldBemValResid from Pat_Saldo_Bem as PS With(Nolock...
asked by 19.10.2018 / 16:55
1
answer

Query joining two tables and populating fields conditionally

I'm a beginner in SQL and would like to know if they could help me with an issue. I have two tables, one is Cadastro_Func and the other CadastroFocal . 'Cadastro_Func' has the columns: 'Nickname' 'Name' 'Cargo' 'Register_Foca...
asked by 17.10.2018 / 05:42
1
answer

How to view the columns of a system view in SQL Server?

Well I come from the Oracle culture and want to learn about SQL Server. I would like to know how I see the columns of a system view, for example: I tried with sp_help teste.INFORMATION_SCHEMA.ROUTINES and desc teste.INFORMATIO...
asked by 05.08.2018 / 17:17
1
answer

List Missing Period Days in SQL Server

How would I be able to do with what in SQL Server when confronting a table that holds the status records of a given code with a period table (Calendar of days) it brings me all the codes that are missing on those particular days For example,...
asked by 27.07.2018 / 21:15
1
answer

select distinct in temp table sql server

I have the following code: (it is from a table that the representatives have the same code, which generates duplicate values, I solve this by picking the most current representative, in short the last face that synchronized) / em> select dist...
asked by 04.10.2018 / 21:41
1
answer

Syntax error in 'with' with SQL Server

Have the following error in sql server:    Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement should be terminated with...
asked by 02.07.2018 / 22:11