Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Creating more rows based on a sequence number

Author  Topic 

NickC
Yak Posting Veteran

68 Posts

Posted - 2011-10-24 : 11:12:19
Bit complicated but I am creating a query which has 1 row , one column is labeled sequence number and then has a number between 1-72. I need to duplicate the same row that many times, so I can insert into values based on a percentage calculation (another issue)

I saw someone where CREATE Sequence - but not MS Sql - is there something similar or a more obvious method I should be using?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-24 : 11:16:47
have a look at ROW_NUMBER() to generate sequence number. For inserting same row multiple times you need to use CROSS JOIN with a number or tally table.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -