T-SQL: if exists always return true ?
Posted
by msfanboy
on Stack Overflow
See other posts from Stack Overflow
or by msfanboy
Published on 2010-05-11T07:37:29Z
Indexed on
2010/05/11
7:44 UTC
Read the original article
Hit count: 214
Hello,
What do you think , does the Stored Procedure always return 1 ?
I am concerned about the if exists(..)
BEGIN
DECLARE @IsUserExisting bit
SET NOCOUNT ON
IF Exists
(
Select null FROM G_User WHERE
SamAccountName = @SamAccountName
AND NetBIOSDomainName = @NetBIOSDomainName
)
BEGIN
SET @IsUserExisting = 1
END
ELSE
BEGIN
SET @IsUserExisting = 0
END
Select @IsUserExisting
END
© Stack Overflow or respective owner