February 7, 2008 at 6:27 am
HI,
I need to log the results of my DML queries into a table for analysis purposes.
Example:
Update dbo.client
set Client_name = Upper(Client_name)
where Client_register_date > getdate()-2
the result of this query will show for instance : (10 row(s) affected)
Is there a way to catch the value "10" in a variable? Or,is there a way to redirect the whole result into a table?
Thanks
Sami ASSI
February 7, 2008 at 6:52 am
Read about @@ROWCOUNT in Books Online.
N 56°04'39.16"
E 12°55'05.25"
February 7, 2008 at 7:01 am
To capture the rows moved have a look at the OUTPUT clause.
----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software
February 7, 2008 at 7:02 am
Thanks Ten centuries:)
this is exactly what I need.
Sami
February 7, 2008 at 7:06 am
Here is a few examples how to use OUTPUT
http://weblogs.sqlteam.com/peterl/archive/2007/10/03/New-OUTPUT-operator.aspx
N 56°04'39.16"
E 12°55'05.25"
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply