can't get "# of rows affected" when executing a tored procedure
-
Hi I've an UPDATE statement inside a stored procedure, when I execute the SqlCommand.ExecuteNonQuery() function I get a return value of -1, but I need to get the # of rows affected by the update statement. Any Idea how to do this? Thanks
And ever has it been that love knows not its own depth until the hour of separation Mohammad Gdeisat
-
Hi I've an UPDATE statement inside a stored procedure, when I execute the SqlCommand.ExecuteNonQuery() function I get a return value of -1, but I need to get the # of rows affected by the update statement. Any Idea how to do this? Thanks
And ever has it been that love knows not its own depth until the hour of separation Mohammad Gdeisat
-
Hi I've an UPDATE statement inside a stored procedure, when I execute the SqlCommand.ExecuteNonQuery() function I get a return value of -1, but I need to get the # of rows affected by the update statement. Any Idea how to do this? Thanks
And ever has it been that love knows not its own depth until the hour of separation Mohammad Gdeisat
declare a variable and, after the update,
set @Var = @@Rowcount Select @Var Records
Never underestimate the power of human stupidity RAH
-
declare a variable and, after the update,
set @Var = @@Rowcount Select @Var Records
Never underestimate the power of human stupidity RAH
Thanks alot, it worked! :)
And ever has it been that love knows not its own depth until the hour of separation Mohammad Gdeisat
-
Add an OUT parameter to your stored procedure and using it, return the number of affected rows. To resolve it inside the procedure use @@ROWCOUNT.
The need to optimize rises from a bad design.My articles[^]
Thanks alot, it worked! :-)
And ever has it been that love knows not its own depth until the hour of separation Mohammad Gdeisat