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 |
|
ramdas
Posting Yak Master
181 Posts |
Posted - 2004-02-06 : 08:48:41
|
| Hi Folks,I want to perform a audit on the result of the following statementDECLARE @row_cnt intDELETE FROM table_a --I want to capture number of rows deletedIF @@ERROR=0 SELECT 'Number of Rows Deleted :'+convert(varchar,@row_cnt)Where will i set the variable @row_cnt=@@ROWCOUNT, i cannot do it inside the IF because the value of @@rowcount will be reset. In a nut shell, if the delete operation succeeds i want to report the number of rows deleted.Ramdas Ramdas NarayananSQL Server DBA |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-02-06 : 09:26:25
|
| DECLARE @rowcount int, @error intDELETE FROM table_a --I want to capture number of rows deletedselect @error = @@error, @rowcount = @@rowcountIF @error=0SELECT 'Number of Rows Deleted :'+convert(varchar,@rowcount)==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
ramdas
Posting Yak Master
181 Posts |
Posted - 2004-02-06 : 09:41:18
|
| Thank youRamdasRamdas NarayananSQL Server DBA |
 |
|
|
|
|
|