Thursday, February 9, 2012

@@rowcount

Hello Experts,
I'm a little bit , see my code below:
declare @.a as tinyint
set @.a = 3
Print @.@.rowcount
why @.@.rowcount has the value 1? I didn't select any row.
Thanks in advance@.@.ROWCOUNT always populate the value of rows affected by the last operation.
Variable assignment is considered as a single row operation.
See below
declare @.a as tinyint
set @.a = 3
Print @.@.rowcount
Print @.@.rowcount
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"x-rays" <xrays@.discussions.microsoft.com> wrote in message
news:03B80B32-7AC0-423D-BA2B-7DCBD3B85C21@.microsoft.com...
> Hello Experts,
> I'm a little bit , see my code below:
> declare @.a as tinyint
> set @.a = 3
> Print @.@.rowcount
> why @.@.rowcount has the value 1? I didn't select any row.
> Thanks in advance|||Great, I got problems now, I'll better hurry up.
Thank u Thomas.
"Roji. P. Thomas" wrote:

> @.@.ROWCOUNT always populate the value of rows affected by the last operatio
n.
> Variable assignment is considered as a single row operation.
> See below
> declare @.a as tinyint
> set @.a = 3
> Print @.@.rowcount
> Print @.@.rowcount
>
>
> --
> Roji. P. Thomas
> Net Asset Management
> https://www.netassetmanagement.com
>
> "x-rays" <xrays@.discussions.microsoft.com> wrote in message
> news:03B80B32-7AC0-423D-BA2B-7DCBD3B85C21@.microsoft.com...
>
>|||It is the 'forget' issue that i was referring to (dbcc checkident ').
I was not aware of the instead of trigger issue - thanks for pointing that
out.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OlOx3uEiFHA.2072@.TK2MSFTNGP14.phx.gbl...
> In what way? To my knowledge, there has been no change to the @.@.IDENTITY
> function since 6.0 (when it was introduced).
> There has been improvements in the handling of identity in general, a
> major improvement between 6.5 and 7.0, there 6.5 could "forget" the
> current value. That was not related to @.@.IDENTITY function per se.
>
> Yes, SCOPE_IDENTITY() is the obvious choice. However, watch out for this
> if you are using instead of triggers!
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Mercury" <me@.spam.com> wrote in message
> news:db4jon$q7b$1@.lust.ihug.co.nz...
>

No comments:

Post a Comment