SteveMac32
Programmer
Is it possible to set a local variable a default value, I ask this because the sample below is passed a value from a VB6 program if there is no value passed or a empty string is passed then the SQL statement should go down one path ‘Select * From TableA’ and if there is a string passed then enter the other path. I just run the simplified sample below and get:
Cannot assign a default value to a local variable, Must declare the variable '@VarABC' and Incorrect syntax near the keyword 'Else' I assume they all stem from the first error
Declare @VarABC char(4) = Null
If @VarABC Is Null
Select * From TableA
Else
Select * TableB
Thanks
Steve
Cannot assign a default value to a local variable, Must declare the variable '@VarABC' and Incorrect syntax near the keyword 'Else' I assume they all stem from the first error
Declare @VarABC char(4) = Null
If @VarABC Is Null
Select * From TableA
Else
Select * TableB
Thanks
Steve