April 26, 2012 at 7:18 am
i have this bit of code:
if 'TODAY' != upper ('$(runDate)')
set @RReffectiveRunDate = convert (datetime, '$(runDate)', 120);
i get an error cannot convert to date / or time from string
ant ideas??
April 26, 2012 at 7:24 am
The string "$(runDate)" is not a valid date. And that's not a function or anything, that's a literal string "$(runDate)"
What are you trying to do?
Also, this
if 'TODAY' != upper ('$(runDate)')
equates to
if 'TODAY' != '$(RUNDATE)'
ie, comparing two literal strings (no variables there) and those two literal strings can never be equal.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 26, 2012 at 10:41 am
Is this SQL being compiled by an outside script? If it is we'll need to know what value is in $(runDate) when it's passed to SQL when you're having a problem. If that is the actual value then Gail's post explains what's going on.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply