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.
Author |
Topic |
sqlservernovice
Starting Member
9 Posts |
Posted - 2012-12-13 : 16:26:34
|
Hi, i have data in the format of a date and the key for each day and for each key i have to create 10 values as part of creating test data. how can i do it using sql serverdate key 2011-01-01 2212011-01-01 232322011-01-01 2342342011-01-01 23432011-01-01 9872011-01-01 66022011-01-01 7878792011-01-01 8605578the output would look like2011-01-01 221 1 0 2011-01-01 221 2 0 2011-01-01 221 3 0... so on 10 values 2011-01-01 23232 1 0 2011-01-01 23232 2 0...so on. |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2012-12-13 : 19:48:03
|
Here is what i understoodSelect t.date,P.a,0 from Table tOUTER APPLY( Select 1 as a union all Select 2 union all Select 3)P |
|
|
sqlservernovice
Starting Member
9 Posts |
Posted - 2012-12-14 : 10:05:38
|
Thanks, this works for me. |
|
|
|
|
|