Why can’t I do this?
EXEC mySproc NCHAR(0xA5)
I get
Incorrect syntax near ‘0xa5’.
yet, I can do this
DECLARE @foo NCHAR
SET @foo = NCHAR(0xA5)
EXEC mySproc @foo
and even this
SELECT NCHAR(0xA5)
It is interesting how SQL server chooses to evaluate expressions. Any thoughts?
Because it violates an T-SQL stored procedure call syntax which states:
where value
thus
you should first perform all the calculations, place the results into variables and then pass the variables into SP call