Questions tagged as 'tsql'

1
answer

Handling locks in a concurrent environment

I am working on a system with 15 concurrent processes that perform several operations against a SQL SERVER database, the versions can go from 2005 to 2014. Each process has its particular data in several tables, no process queries / deletes / up...
asked by 19.04.2017 / 11:08
2
answers

Queries with hours in SQL Server?

I have a question about how I can make queries in SQL Server with hours fields. I have a column called hora_inicio_prestamo and another hora_fin_prestamo , both of type time(0) , I also have a column called Estado_presta...
asked by 07.04.2017 / 03:05
1
answer

UPDATE from a SELECT using SQL Server

In SQL Server, it is possible to make a INSERT INTO to a table using a SELECT : INSERT INTO tabla (col, col2, col3) SELECT col, col2, col3 FROM otra_tabla WHERE sql = 'ok' Is this also possible for a UPDATE ? I have a...
asked by 09.02.2017 / 17:21
2
answers

What does the = * mean in the where?

Good afternoon, I would like you to support me with this. I have a query select ... FROM DBSosst..SRG_SUMMARY_NAVIGATION, SALDOS_prueba1 a WHERE GROUP_ID = 4 and STRUCTURE_ID = 1118 and SUMTO...
asked by 07.05.2016 / 00:33
1
answer

Concatenate values resulting from an INNER JOIN in a string separated by commas in SQL Server 2012

I have the following schema in SQL Server 2012: Tabla 1 Id INT PRIMARY KEY Descripcion NVARCHAR(20) Tipo INT Tabla 2 Id INT PRIMARY KEY Nombre NVARCHAR(80) IdTabla1 INT --Llave foranea a la primera tabla Tabla 3 Id INT PRIMARY KEY Nombre NV...
asked by 09.11.2016 / 16:52
1
answer

Consult last access date Login MS SQL Server

To know the last access of a Login to a database in SQL Server; Perform the following query to obtain dates however the LOGINPROPERTY function does not contain the last login date of Login. SELECT dbp.name AS [nombreUsuarioBD],...
asked by 14.09.2017 / 17:11
2
answers

Select fields with unique id and other conditions

I have a table with several fields and my goal is to bring only the id that appear only once and whose fields 3 and 4 are not null (any of them) The query you make is the following SELECT id FROM tabla WHERE campo3 IS N...
asked by 02.08.2017 / 16:50
3
answers

Top 1 for each group in a Group by SQL Server

I have a table similar to this one CancelLog |ID| membrecia| User | DateCancel | Motivo | | 2| 1 | uS1 | 7/29/2011 | ... | | 3| 1 | uS2 | 7/30/2011 | ... | | 6| 1 | uS1 | 8/02/2011 | ... | |...
asked by 17.03.2017 / 22:16
2
answers

How to merge multiple records into one using SQL SERVER?

I need this table: Be this: (edit it as an image using paint to show as an example) The data will always have the same 'serverName', DATE and TIME in common     
asked by 04.10.2018 / 18:48
1
answer

Change database using variable @databaseNameVariable

How to change the database with the name of the base stored in variable ?; Do the following code, however, do not change the database. DECLARE @inicio VARCHAR (100) DECLARE @bdname VARCHAR (100) DECLARE @usedb VARCHAR (100) SET @inicio =...
asked by 21.08.2017 / 20:18