In SQL Server 2012, you could use the IIF
function:
SELECT *
FROM table
WHERE isExternal = IIF(@type = 2, 1, 0)
Also note: in T-SQL, the assignment (and comparison) operator is just =
(and not ==
– that’s C#)
In SQL Server 2012, you could use the IIF
function:
SELECT *
FROM table
WHERE isExternal = IIF(@type = 2, 1, 0)
Also note: in T-SQL, the assignment (and comparison) operator is just =
(and not ==
– that’s C#)