Hello All, I am trying to create a conditional statement for a stored procedure. Before adding this statement to the procedure, I am able to pull data from the procedure properly.
IF @ipDeclaredParameter IS NULL
SELECT MAX(fieldName) FROM tableName
The Select statement calls a table and that table ends up remaining the reference for the remainder of the stored procedure so all other references to the other FROM that occurs later are not recognized throwing an SQL error that the column names I am calling
are not a part of any tables in the FROM.
Also, in the conditional statement seen above, I am trying to do select MAX(DISTINCT), am I doing it correctly?
Thanks in advance.
View Complete Post