⌘BABAKOV.NET Let's code!
100% [dark] [ru]
~/tags/tsql $

#TSQL

18 posts

18 total · page 2 / 2

OFFSET FETCH - Limiting Result Set in MSSQL

"OFFSET FETCH" is a filter that allows skipping a certain number of rows in the result set. For example: select field1, field2, field3 from table1 order by field1, field2 offset 100 rows fetch next 50 rows only; This example will return rows from 101 to 150, from all rows sorted by field1 and field2.

18 views 0 comments 0 likes ./Read →

Example of Date Range Selection in MSSQL

Example of Date Range Selection: WITH q AS ( SELECT 1 AS num UNION ALL SELECT num + 1 FROM q WHERE num < 10 ) SELECT DATEADD(DAY,0,cast(cast(DATEADD(DAY,-num,SYSDATETIME()) as date) as datetime)) FROM q Simple version of the example of selecting a range of numbers:

18 views 0 comments 0 likes ./Read →