tran008
Ten Centuries
Points: 1002
More actions
July 31, 2003 at 2:22 pm
#81355
is there a better way to write this statement:
DECLARE @xxx as mvarchar
if (select col from table where col=@xxx) is not null
update table statement
else
insert table statement
brendt hess
Hall of Fame
Points: 3256
July 31, 2003 at 2:24 pm
#468099
I personally would use:
If Exists (Select Col from Table where Col = @xxx)
Update
Else
Insert
5409045121009-7368
SSCoach
Points: 15740
July 31, 2003 at 6:40 pm
#468120
Agree EXISTS is supposedly to be faster!
I just return '1' versus (* or a column).
If Exists (Select '1' from Table where Col = @xxx)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply