Author |
Topic |
sqlserverdeveloper
Posting Yak Master
243 Posts |
Posted - 2008-08-14 : 17:02:42
|
I have a simple question, I am trying to execute a storedproc the following way which has about 5 input parameters.SQL:Execute storedprocSelect col1,col2,col3,col4,col5 from #TempI am passing in col1,col2,col3,col4,col5 as parameters. I am getting the follow error:Msg 201, Level 16, State 4, Procedure storedproc, Line 0Procedure 'storedproc' expects parameter '@param1', which was not supplied.Thanks for your responses!! |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-08-14 : 17:10:12
|
You can't run a SELECT statement and pass that to a stored procedure, like that at least. Could you explain what you are trying to do?Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-08-14 : 17:12:41
|
[code]DECLARE @Col1 INT, @Col2 INT, @Col3 INT, @Col4 INT, @Col5 INTSELECT @Col1 = Col1, @Col2 = Col2, @Col3 = Col3, @Col4 = Col4, @Col5 = Col5FROM #TempEXEC StoredProc @Col1, @Col2, @Col3, @Col4, @Col5[/code] E 12°55'05.25"N 56°04'39.16" |
 |
|
sqlserverdeveloper
Posting Yak Master
243 Posts |
Posted - 2008-08-14 : 17:29:52
|
quote: Originally posted by Peso
DECLARE @Col1 INT, @Col2 INT, @Col3 INT, @Col4 INT, @Col5 INTSELECT @Col1 = Col1, @Col2 = Col2, @Col3 = Col3, @Col4 = Col4, @Col5 = Col5FROM #TempEXEC StoredProc @Col1, @Col2, @Col3, @Col4, @Col5 E 12°55'05.25"N 56°04'39.16"
Thanks! it worked. |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-08-14 : 17:34:05
|
Remember if you have several records in #Temp table and want to execute StoredProc for all of them, record by record, you have to implement a loop mechanism. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|