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 |
|
xoail
Starting Member
9 Posts |
Posted - 2008-05-16 : 17:55:50
|
| While exicuting a stored procedure, I want to provide the following parameters on which one needs to have values 2 to 200 and the procedure must run for each value at a time. Its something like thisexec procedurename @para1 =123, @para2=3432, @para3 = from 2 to 200Obviously Im getting a syntax error. How can I write the values for para3?Appreciate your help!Thanks. |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-05-16 : 18:25:20
|
| I'm suspicious of the need to "run for each value at a time"...but anywayyou could split them into 2 ie: @para3From and @para3To (that is what I'd do)you could encode a value using a string or binary ie: binary(8) 0x00000002000000C8 (two 4 bytes together)or '2-200' then split the value using string functions.Be One with the OptimizerTG |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-17 : 02:51:12
|
quote: Originally posted by xoail While exicuting a stored procedure, I want to provide the following parameters on which one needs to have values 2 to 200 and the procedure must run for each value at a time. Its something like thisexec procedurename @para1 =123, @para2=3432, @para3 = from 2 to 200Obviously Im getting a syntax error. How can I write the values for para3?Appreciate your help!Thanks.
What is the procedure doing and why are you calling it for range of values? |
 |
|
|
ganeshkumar08
Posting Yak Master
187 Posts |
Posted - 2008-05-17 : 05:38:22
|
| try it in While loop..Declare @i intset @i=2While @i<=200Begin exec procedurename 123, 3432, @iEnd |
 |
|
|
bjoerns
Posting Yak Master
154 Posts |
Posted - 2008-05-19 : 05:51:58
|
Hey and insert an 'set @i = @i + 1' after the exec. Takes too long otherwise. |
 |
|
|
xoail
Starting Member
9 Posts |
Posted - 2008-05-19 : 09:19:59
|
| Its taking a long time using the while loop. Any other way?Thanks! |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-05-19 : 09:21:27
|
Yes. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|
|