I have several stored procedures that take a date/time input, one of which takes a date only in the form of a
nvarchar because it utilizes dynamic SQL. When I try to cast the variable going into the stored procedure, I get an error. This doesn't make much sense to me.
I know I can work around it by creating a second set of
nvarchar variables or casting within the stored procedure, but I'd like some insight on why I can't just cast the variable in-line.
Example. *TOP is a Select statement telling me my NVARCHAR DATE kicks out just fine.
MID is where SSMS is throwing the error, BOTTOM is where SSMS thinks it's just fine.*