@@IDENTITY And @@ROWCOUNT

@@IDENTITY :
After an INSERT, SELECT INTO, or bulk copy statement is completed,
@@IDENTITY contains the last identity value that is generated by the statement.
If the statement did not affect any tables with identity columns, @@IDENTITY returns NULL.
If multiple rows are inserted, generating multiple identity values, @@IDENTITY returns
the last identity value generated.

@@ROWCOUNT :
Transact-SQL statements can set the value in @@ROWCOUNT in the following ways:
Set @@ROWCOUNT to the number of rows affected or read. Rows may or may not be sent to the client.
Preserve @@ROWCOUNT from the previous statement execution.
Reset @@ROWCOUNT to 0 but do not return the value to the client.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s