Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8339037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:46:25+00:00 2026-06-09T04:46:25+00:00

What is the scope of @@rowcount ? MSDN doesn’t mention its scope. Returns the

  • 0

What is the scope of @@rowcount ?MSDN doesn’t mention its scope.

Returns the number of rows affected by the last statement.

Ok.

In my SP — I’m inserting into a table , which has a insert trigger which does another insertion when a new value is inserted to the table.

Question:

To which scope the @@rowcount will refer ? (trigger or SP) ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:46:26+00:00Added an answer on June 9, 2026 at 4:46 am

    Granted, the article is for SQL Server 2000, but one would hope the scope doesn’t change between versions. According to the article How triggers affect ROWCOUNT and IDENTITY in SQL Server 2000, @@ROWCOUNT will not be affected by triggers.

    Specifically:

    It’s safe to use @@ROWCOUNT in SQL Server 2000 even when there is a trigger on the base table. The trigger will not skew your results; you’ll get what you expect. @@ROWCOUNT works correctly even when NOCOUNT is set.

    So if you update three rows, and the trigger updates five rows elsewhere, you’ll get a @@ROWCOUNT of 3.

    Also, from GBN’s answer in SQL Server – is using @@ROWCOUNT safe in multithreaded applications?:

    @@ROWCOUNT is both scope and connection safe.

    In fact, it reads only the last statement row count for that connection and scope.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The below code is not working <c:forEach var=row varStatus=rowCount begin=1 end=10> <c:set var=entry scope=request
I have a query that returns a bunch of rows. But using the same
I'm inserting a number of instances of a particular object to a database using
I have a statement I'm using in PHP that will pull a number if
Some scope creep occured in the last couple of days and now I have
Global scope allows you to use a variable in a function that was defined
The scope of my question is solely ASP.NET, as the answer may be different
The scope of this is that we have three main projects. Some of the
I've struggled with scope for a few days. I would like to have a
I have a named scope set up in my rails application that is used

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.