Questions tagged as 'sql-server'

1
answer

Query with condition of displaying only records that contain the same consecutive 3x number

I have the following query: with Consulta as ( SELECT V.CHAPA, F.NOME, V.DATA, F.FILIAL, DATENAME(dw,V.DATA) AS DIA, MAX(V.SEQUENCIALBATIDA) AS BATIDA FROM V_BATIDASANTIGAS AS V LEF...
asked by 23.10.2016 / 23:55
1
answer

Query with datadiff returning 0 in sql server result

I have the following query: SELECT DATEDIFF(hh, MIN(BATIDA), MAX(BATIDA))AS HORAS FROM ARELBATIDATRANSITOVIEW WHERE CHAPA = 3187 AND BATIDA IS NOT NULL AND SEQUENCIALBATIDA IN (2,3) GROUP BY DATA ORDER BY DATA DESC Example:...
asked by 19.10.2016 / 03:51
2
answers

Doubt with DROP command COLUMN sql server

I tried to delete a column from a database, I noticed that there are restrictions. ALTER TABLE dbo.TB_ESTRACAO DROP COLUMN MULTIPLIER I get a message, how can I resolve this? Thanks!    Message 5074, Level 16, State 1, Line 1   The obje...
asked by 24.07.2016 / 01:48
1
answer

SQL server error

I'm doing select below and I can not execute: SELECT DISTINCT U2.NM_ORG AS [Orgão Subordinado], U1.NM_ORG AS [Unidade Gestora], E.NM_EPG AS [Nome Funcionário(a)], C.NM_CG AS [Cargo Funcionário(a)], D.CD_DOC_...
asked by 18.05.2016 / 15:57
1
answer

Importing backup of sql server from another server

I can not import a backup (.bak) into the sql generated on another server, it says that the database is not the same as the one I'm trying to import and tals, and I put the same name. Does anyone know what might be happening?     
asked by 16.04.2016 / 02:07
1
answer

How to delete record of 2 tables being one containing 0 to left SQL SERVER

I have 2 tables in which one is inserted the records that come from a file txt and the other the records that come from a file excel . With this, I need to delete the records of the txt table that contain the excel...
asked by 20.04.2016 / 16:58
1
answer

Total SQL Records in all columns

I need to return the total records of the query in a column, repeated same, type this: However, the query is a bit annoying. A query of 106 rows, with multiple SUM () and with a mandatory ORDER BY. I can not use GROUP BY in this query beca...
asked by 05.04.2016 / 17:34
1
answer

C # with Storeprocedure

Good evening guys I'm doing a system for college and I'm trying to do with the procedure but it's not recording in the bank I think there's something wrong but I do not think so. I tried to use CM.Parameters.AddWithValue and CM.Parameters .Add m...
asked by 28.03.2016 / 04:31
3
answers

Condition in Where SQL Server

I have a SELECT with several LEFT JOIN , however I need to consider all these LEFT JOIN in some conditions, already in another condition I need disregard a made JOIN .    As an example: SELECT * FROM TabelaTot...
asked by 22.03.2016 / 21:11
1
answer

How to create a local database in SQL server 2016? [closed]

I installed SSM 2016 (Sql Server Management Studio) for days on my PC but I can not create a local database. The only thing I do is connect to a database that I hosted in azure, but when I go to create a local DB it gives error with the follo...
asked by 22.04.2016 / 20:49