Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create data from a range
Message
 
 
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:
01609617
Views:
42
>Hi
>
>I have a list of data
>
>ID From To
>1001 100 103
>
>I want to use this to create data rows in another table
>
>ID Type
>1001 100
>1001 101
>1001 102
>1001 103
>
>any thoughts on the best way to do this in sql
>
>Thanks
>
>Nick

For such problems the best solution will be to have 2 permanent tables in the database: Numbers and Calendar.

Check this blog post

http://www.toadworld.com/platforms/sql-server/b/weblog/archive/2011/01/04/filling-in-data-potholes-redux-tally-tables-vs-ctes.aspx

You may also check my blog post where I provide scripts and links to the Numbers and Calendar tables:

http://blogs.lessthandot.com/index.php/datamgmt/datadesign/passing-multiple-ranges-to-stored-proced/
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform