How can you get @@error and @@rowcount at the same time?
Answers were Sorted based on User's Feedback
Answer / gunasekaran k.j
SELECT @@Rowcount as rwCount, @@Error as Er
| Is This Answer Correct ? | 15 Yes | 2 No |
Answer / pankaj
If @@Rowcount is checked after Error checking statement then
it will have 0 as the value of @@Recordcount as it would
have been reset. And if @@Recordcount is checked before the
error-checking statement then @@Error would get reset. To
get @@error and @@rowcount at the same time do both in same
statement and store them in local variable. SELECT @RC =
@@ROWCOUNT, @ER = @@ERROR
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / binoo tiku
@@error variable shows the error number of the last
T-SQL error
@@rowcount variable gives the number of rows affected by
the most recent SQL statements.
| Is This Answer Correct ? | 9 Yes | 7 No |
Answer / raji
@@error - displays the error number of last T-Sql statement
@@rowcount - displays the total row count of last T-Sql
statement
| Is This Answer Correct ? | 3 Yes | 2 No |
Answer / sachin rakshe
If @@Rowcount is checked after Error checking statement then
it will have 0 as the value of @@Recordcount as it would
have been reset. And if @@Recordcount is checked before the
error-checking statement then @@Error would get reset. To
get @@error and @@rowcount at the same time do both in same
statement and store them in local variable. SELECT @RC =
@@ROWCOUNT, @ER = @@ERROR
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / yjreddy
select @@ROWCOUNT
it will give the no of rows affected by last sql statement
select @@ERROR
it will display the error number for last sql statement
| Is This Answer Correct ? | 0 Yes | 3 No |
Answer / ramakrishna
DECLARE @RC int
DECLARE @ER int
INSERT INTO T(Cal1,Col2..)
SELECT ColX,ColY..
FROM T1
SELECT @RC = @@ROWCOUNT
SELECT @ER = @@ERROR
| Is This Answer Correct ? | 3 Yes | 16 No |
What is mapping schema?
Which table keeps information about stored procedures?
How to declare and use cursor variables?
Explain nested trigger in sql?
What is merge join?
Comment,Datatypes are unlimited
Explain indexes disadvantages?
What are the types of subscriptions in SQL Server replication?
What structure can you implement for the database to speed up table reads?
Explain syntax for viewing trigger?
What is difference between sql and sql server?
whate is advantages of sql server 2000
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)