Geeks With Blogs

Victor Cassel A Microsoft data programmer guy in Stockholm March 2016 Entries
Numeric Range and DateRange functions for Sql Server
Here is a surprisingly effective way of generating integer sequences, and date ranges on sql server. This source code is also available at githubFirst we need a function that generates the numbers from 0 to 99.ALTER FUNCTION [dbo].[Nums100] ( ) RETURNS TABLE AS RETURN ( SELECT 0 rownum union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9 union SELECT 10 union select 11 union select 12 union select 13 union select 14 ......

Posted On Tuesday, March 15, 2016 11:07 PM

Copyright © Victor Cassel | Powered by: GeeksWithBlogs.net