Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create data from a range
Message
 
 
À
17/10/2014 06:50:58
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2014
Application:
Web
Divers
Thread ID:
01609576
Message ID:
01609617
Vues:
40
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform