My script has a variable that does not always contain a value. If there is a value, I need an extra WHERE
clause.
DECLARE @identityUserIds NVARCHAR;
SELECT @identityUserIds = (SELECT TOP (1) [userIdsCsv] FROM [identityUsers])
SELECT *
FROM [Users]
-- IF (!ISNULL(@identityUserIds) OR @identityUserIds != '')
WHERE [ID] in (@identityUserIds)
-- ELSE (no extra condition)
How can I do that?