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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 sp_executesql help needed

Author  Topic 

Dave_007
Starting Member

15 Posts

Posted - 2008-06-12 : 23:46:36
Hi,
I want to use the output of the sp_executesql to update a coulmn in the table.
example
-first i run the below to get output
execute sp_executesql @Query, @returnedCount output

-then I want to use that output to update another coulmn in the table
update tableName set coulmn=@returnedCount

I am new to this and cannot figure out how. Can someone please guide me?
thank you!!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-13 : 00:20:40
Where's the parameter definition. You need to first define parameters to be passed to query including OUTPUT parameter and then give the values. Like

execute sp_executesql @Query,@ParamDefinition,@Param1=@Variable1/value1,@Param2=@Variable2/Value2,..@OutputParam= @returnedCount OUTPUT

and then use it

update tableName set coulmn=@returnedCount
Go to Top of Page
   

- Advertisement -