The Wrecking Bawl

Destructuring query language, one keyword at a time.


News


A coworker and I discovered the other day that we got an error when we tried using CAST on a parameter in the same line as the procedure call.  For example:

EXEC [procname] @param1, CAST(@param2 AS DATETIME)

result: Invalid syntax near 'cast'.

That statement didn't work till we separated it into two lines, like so:

SET @param2 = CAST(@stringdatevar AS DATETIME)

EXEC [procname] @param1, @param2

I haven't been able to google up any proof that the first call should cause an error, so it would be greatly appreciated if somebody could drop me a link.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Comments

No comments posted yet.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: