I would like to declare a variable within an if/else statement in a SQL Server stored procedure. I understand that this is fairly impossible because SQL Server doesn\'t do m
is there some reason why you can't do :
declare @bob int if exists(x) begin set @bob = 1 end else begin set @bob = 2 end