Skip to main content
added 41 characters in body; edited title
Source Link
marc_s
  • 9k
  • 6
  • 45
  • 52

Can't cast a SPROCstored procedure parameter?

I have several sprocsstored procedures that take a date/time input, one of which takes a date only in the form of an nvarchara nvarchar because it utilizes dynamic SQL. WhenWhen I try to cast the variable going into the sproc I'm met withstored procedure, I get an error. ThisThis doesn't make much sense to me.

I know I can work around it by creating a second set of nvarcharnvarchar variables or casting within the sprocstored 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. *TOP is a Select statement telling me my NVARCHAR DATE kicks out just fine.

sproc wtfmanMID is where SSMS is throwing the error, BOTTOM is where SSMS thinks it's just fine.*

stored procedure wtfman

Can't cast a SPROC parameter?

I have several sprocs that take a date/time input, one of which takes a date only in the form of an nvarchar because it utilizes dynamic SQL. When I try to cast the variable going into the sproc I'm met with 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 sproc, 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.

sproc wtfman

Can't cast a stored procedure parameter?

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.*

stored procedure wtfman

Source Link
n8.
  • 222
  • 3
  • 11

Can't cast a SPROC parameter?

I have several sprocs that take a date/time input, one of which takes a date only in the form of an nvarchar because it utilizes dynamic SQL. When I try to cast the variable going into the sproc I'm met with 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 sproc, 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.

sproc wtfman