April 8, 2005 at 8:56 am
PW,
Whether it fails or not its useful to know - so definately worth trying.
As it happens, it worked.
Lets take the next logical step - test YYYYMMDD using a CAST...this worked as well.
So lets summarise further (and hopefully wrap this up)
1. If the data is specified as YYYYMMDD a cast or a convert will work
2. If the data is specified as YYYY-MM-DD use a convert with the style parameter specified
3. If the above guidelines are not followed your query may still work but it is fraught with danger. Be unambiguous, be safe, follow guidelines 1 & 2.
Thank you all. I've really learned something today! I always say, "You learn most when things go wrong"!
cheers
Jamie Thomson
http://sqlblog.com/blogs/jamie_thomson
April 8, 2005 at 9:35 am
In case anyone's bothered I've blogged about this here.
Jamie Thomson
http://sqlblog.com/blogs/jamie_thomson
April 8, 2005 at 10:54 am
You could try checking the default language for the user account that your QA runs under and the server default language. It may be that one uses English and the other British English.
April 11, 2005 at 7:51 am
Jamie, I'm not doubting what you are describing has happened to you but I find it odd that when I try to duplicate this I am unable to produce the same results with the error. The only difference between what I did and your code was that I replaced your TABLE.COLUMN reference with literal values or numbers. Could doing that prevent the error from occurring? I also did not know if your Stored Procedure was passed any values used in the conversion and so my Stored Procedure did not pass any values. Could that be the difference?
Thanks
Ed
Kindest Regards,
Just say No to Facebook!April 11, 2005 at 8:05 am
Ed,
I think the different behaviour more likely due to some server setting, perhaps default language as suggested by Dave Ellard. As I eluded to in my blog post, if you don't follow the guidelines that I postulated your code may indeed still work perfectly well.
Following my guidelines should guarantee (short of there being something that I haven't come across yet) that it will work.
I doubt that using literal values instead of column values would make any difference.
My SP did not use any parameters in the code snippet in question.
Jamie Thomson
http://sqlblog.com/blogs/jamie_thomson
Viewing 5 posts - 16 through 19 (of 19 total)
You must be logged in to reply to this topic. Login to reply