Question : I am writing a stored procedure that needs to send an email when a dvd rw drive is […]
Tag: t-sql
Selecting closest, non expired value [duplicate]
Question : This question already has answers here: Retrieving n rows per group (6 answers) Closed 6 years ago. I’m […]
Join tables on a partial string match
Question : input: I have a table containing (any number of) user-supplied strings: ╔═══════╗ ║ Value ║ ╠═══════╣ ║ To […]
SQL Work Hours Only
Question : I am working on a report, one of the requirements is that I find the turnaround time between […]
How to insert and or update a variable number of records and prevent concurrency issues
Question : I currently have the following stored procedure. However I am seeing some race conditions where I end up […]
Number of executions of the same sub query by the DB engine
Question : If I have this SQL query SELECT (select count(*) from tableA) as cnt, t1.* FROM ( SELECT t.* […]
what is the best query for inserting data from two tables into one table?
Question : Imagine there are two tables with their columns: 1 – T1(Year,ITscore) 2 – T2(Year,EFQMScore) these two tables are […]
TSQL – merge partitions online
Question : the short version of my question is: “During the merge of two partitions is the whole partitioned table […]
When duplicate date values exist in a column, change the value of the oldest
Question : I have a query that returns records with duplicate Month and Year in a date field. I need […]
Combining data from multiple large tables
Question : I have a customer survey dataset split across 25 different tables. I need to combine all the tables […]