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 |
|
imp_galo
Starting Member
13 Posts |
Posted - 2006-01-26 : 06:04:54
|
| Is it possible to use a select as a stored procedure parameter or do I have to use cursor? For example, I have the following procedure:UpdateTaskProgress @TaskId intIs it possible to use something like the code bellow to update all tasks?EXECUTE UpdateTaskProgress select TaskId from TasksThanks in advance,Ricardo |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-01-26 : 08:15:05
|
| Not sure what u r trying to do!![Its good if ur requirement is written clearly with some example & the result that u want to achieve]U can use a stored procedure - to Update some table / records- to get the results back for viewing- to accept parameters and based on that do an update -- u can pass the complete query (rarely done) as a parameter -- u can pass the selection criteria where clause (again not much used) -- u can pass the data to be updated, and data to be used for search |
 |
|
|
mmarovic
Aged Yak Warrior
518 Posts |
Posted - 2006-01-26 : 12:00:01
|
| You can either use cursor or pass list of taskIds varchar value or ... More details are needed. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-01-26 : 20:16:25
|
Try thisexec master..xp_execresultset N'select ''exec UpdateTaskProgress '' + convert(varchar(10), TaskId) from Tasks', N'<your database name>' Note : xp_execresultset is undocumented----------------------------------'KH' |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-01-27 : 05:44:54
|
| or Run this and copy the result back to Query Analyser and run them as a wholeSelect 'EXECUTE UpdateTaskProgress '+cast(TaskId as varchar) from TasksMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|