Yes.
WHERE does not apply to PK (or a unique index), more than one row may be returned, but this is likely to be an error. In this case, the variable is reassigned, and its final value will depend on the plan.
DECLARE @row_attribute INT select @row_attribute = object_id from sys.objects /*<--No WHERE clause. Undefined what the final value of @row_attribute will be. depends on plan chosen */ SELECT @row_attribute, @@ROWCOUNT
Change They just noticed that your proposed test is if @@rowcount = 0 not if @@rowcount <> 1 , so the above will not affect it, and the whole answer can be reduced to the word "Yes"!
source share