Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create data from a range
Message
From
17/10/2014 08:28:23
 
 
To
17/10/2014 06:50:58
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2014
Application:
Web
Miscellaneous
Thread ID:
01609576
Message ID:
01609582
Views:
38
I started to type a reply and then saw you used a common table expression with recursion. It's a great approach. I use that when I need to create a date range (e.g. all the Saturdays between two dates)


Just a note (and if this was in your code, I missed it) - if you have more than 100 iterations, you'll need to specify MAXRECURSION

Basically at the end of the final SELECT from the common table expression, you'll need....

OPTION (MAXRECURSION 10000)

Or whatever value is safe as a max. Note that it can't go higher than 32,767


But always glad to see someone using that feature.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform