Does Set NoCount On/Off reset @@Error?

  • Does Set NoCount On/Off reset @@Error?

    I was trying to figure out a way to test this in Query analyzer, but whenever I force an error, I never get to move onto the Print Cast (@@Error as varchar(10))

    Thanks,

    Jason

  • Yes it does. Try the following with and without the set nocount on line commented out.

    declare @ErrorCd int

    raiserror ( 'test', 12, 12 )

    set nocount on

    set @ErrorCd = @@Error

    print @ErrorCd

  • Perfect...not sure why I didn't think of that...duh!  Thank you that is exactly what I needed to prove what I believed to be true.

    Jason

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply