Hi i want to run an if statement but keep getting syntax errors near all my AS aliases, what am i doing wrong?
SELECT IF @Origin = \'ALL\' (SELECT COUNT(*
I've just tried the following as a test and it works fine. You should be able to use this as a starting point for your example.
DECLARE @Origin NVARCHAR(200) SET @Origin = 'ALL' IF @Origin = 'ALL' BEGIN (SELECT ('Test') AS HI) END ELSE BEGIN (SELECT ('Test2') AS HI) END