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 2000 Forums
 SQL Server Development (2000)
 Query return value in sp to variable

Author  Topic 

a_r_satish
Yak Posting Veteran

84 Posts

Posted - 2006-03-04 : 01:49:26
Hi
I have a stored procedure. which has multiple selects,inserts and deletes.
In the same sp i have to insert the count of rows affected to a table.

for ex :
when i execute the delete command then, the rows deleted is returned.
so is there a way to move the rows deleted to a local variable and then populate my table using the values filled in local variale.

i don want to use the count(*).

thanks in advance.

Regards,
satish.r

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-03-04 : 02:17:12
"so is there a way to move the rows deleted to a local variable and then populate my table using the values filled in local variale."
you mean number of rows deleted ?

declare @rows_delete int

delete from yourtable
select @rows_delete = @@rowcount
select @rows_delete



----------------------------------
'KH'


Go to Top of Page

a_r_satish
Yak Posting Veteran

84 Posts

Posted - 2006-03-04 : 03:36:40
Ya that was what i wanted.

Thanks

Regards,
satish.r
Go to Top of Page
   

- Advertisement -