Results 1 to 2 of 2

Thread: @@rowcount

  1. #1
    Join Date
    Jan 2002
    Location
    sheffield, uk
    Posts
    14

    Unanswered: @@rowcount

    I am using a combination of SQL Server 6.5 and 2000.

    If I issue a SELECT statement in 6.5 and then query @@ROWCOUNT I get the correct value of it, e.g.
    SELECT * FROM EMPLOYEES
    IF @@ROWCOUNT > 0
    ....etc

    But in SQL Server 2000, I only get the correct value if I SELECT it after, like this, e.g.
    SELECT * FROM EMPLOYEES
    SELECT @@ROWCOUNT
    IF @@ROWCOUNT > 0
    ....etc

    And it also seems to work in 2000 if you put @@ROWCOUNT into a variable, and query the variable.
    Has anyone alse had this problem, and is it a bug in 2000 ?

    Thanks,

    itsmarkdavies@hotmail.com
    Mark Davies
    itsmarkdavies@hotmail.com

  2. #2
    Join Date
    May 2002
    Posts
    299
    @@rowcount works exactly the same in sql2k.

    e.g.
    declare @cnt int
    select * from employees
    select @cnt=@@rowcount
    if @cnt>0
    begin
    print 'you get @@rowcount fine'
    end
    --
    -oj
    http://www.rac4sql.net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •