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 |
|
skillile
Posting Yak Master
208 Posts |
Posted - 2002-01-17 : 22:21:59
|
| If I have a form calling a sproc and the data are values and #of times to insert that value. ie. value, 2xvalue, 1xvalue, 4xvalue, 6xI want to put them into a table such as:create table (value varchar(xx))how do I put the records in this table when the value could be anywhere from 0-50 without using a cursor and without doing something like:if @x=1beginwhile ...begininsert ....endendif @x=2beginwhilebegininsert ...endendslow down to move faster... |
|
|
fisherman_jake
Slave to the Almighty Yak
159 Posts |
Posted - 2002-01-18 : 01:15:13
|
My friend, this would require for you to have a table with one field and the values of this field will be 1,2,3,4,...,N. N is your forseen upper limit (ie from your spec... value, Nx). Now say you called this table [MULTICOUNT], and the only field called [CountID] then your latest and greatest discovery would be:--<TSQL>--Insert TARGETTABLEValues(value)From MULTICOUNTWhere N >= CountID--<TSQL>--This will insert "value", N number of times..Now where is that beer..   I love this JOB..==================================================World War III is imminent, you know what that means... No Bag limits!!!Master Fisherman |
 |
|
|
|
|
|
|
|