DECLARE @command = 'SELECT CASE WHEN ( SELECT COUNT(*)
FROM [table] WITH ( NOLOCK )
WHERE DATEDIFF(minute, systemupdatedtimestamp, GETDATE()) < 10
) > 0 THEN 0
ELSE 1
END'
Now I need to get the 'return value' of the above command (0 or 1).
EXEC(@commnad)
How do I get the return value from the above?
I tried
SET @ReturnValue = EXEC(@command)
but no luck.