@@error and @@rowcount

After an INSERT, UPDATE, or DELETE, select @@error and @@rowcount into a local variable (usually @error and @rowcount).