Hi everyone,
My procedure recieves one argument, "myNumber".
I'd like to declare as many variables as "myNumber"'s value as follows:
When i run the above code i get an error indicating that at line 4, @firstname has already been declared.
Can anyone tell me where i went wrong ?
Thanks
My procedure recieves one argument, "myNumber".
I'd like to declare as many variables as "myNumber"'s value as follows:
Code:
If (@myNumber=1) DECLARE @firstName VARCHAR(20)
IF (@myNumber=2)
BEGIN
DECLARE @firstName VARCHAR(20)
DECLARE @secondName VARCHAR(20)
END
Can anyone tell me where i went wrong ?
Thanks