August 30, 2006 at 2:20 pm
Hi all,
I'm trying to update a column on with the results of stored procedure. I'm trying to do something like this:
update pubs
set booktitle = (exec USP_BuildBookTitleFromTempTable)
where booktitleID =12
Can someone please tell me the correct syntax to accomplish this??
Thanks
August 30, 2006 at 2:30 pm
Use User Defined Functions instead of Stored Procedure
August 30, 2006 at 2:33 pm
Thanks but i need to used temp tbls which cannot be done inside a udf
August 30, 2006 at 2:38 pm
replace your temporary tables with table data type, which is allowed in UDF's
August 30, 2006 at 2:38 pm
Can you show use the sp code so that we can provide an alternate solution?
August 30, 2006 at 2:51 pm
Converting my temp tables to the table datatype and using a UDF instead worked!! Although i could have swore there is a way to invoke a sproc inside a update/select statement... hmmm... perhaps i was huffing too many paint cans that day
August 30, 2006 at 4:17 pm
If you create a perm table and 2 users run the sp at the same time you'll get a error...
Still waiting to see that code...
September 1, 2006 at 4:37 pm
You can try this one :
-- start here
declare @output_param <data type>
exec BuildBookTitleFromTempTable @output_param output -- I'm assumming that you will modify ur sproc to include output param
update pubs
set booktitle = @output_param
where booktitleID =12
-- end
Ignas
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply