I have set of Union statements.I need to validate param if param='123'
then do one more union if not end of select.
When I ran the sp it gives me an error in the union in if statement.
What am I doing incorrect?
Select 1,2,3 from table1
UNION
Select 1,2,3 from table2
...
If @param='123'
Begin
Union
Select 1,2,3 from table3
END
then do one more union if not end of select.
When I ran the sp it gives me an error in the union in if statement.
What am I doing incorrect?
Select 1,2,3 from table1
UNION
Select 1,2,3 from table2
...
If @param='123'
Begin
Union
Select 1,2,3 from table3
END