September 26, 2014 at 8:12 am
BWFC (9/26/2014)
spectra (9/26/2014)
>>>>Remove the CONVERT and you'll be doing the date range check you want.how do you convert 26/09/2014 to Date ?
then you can use Cast(CreatedOn as date)
No.......you misunderstood my query.... I meant ..how do I cast a String to date ?
e.g Cast('9/26/2014' as date) ....Is it Ok ? Do I need to mention dd/mm/yyyy format here ? if so ..how ?
September 26, 2014 at 8:16 am
Now I really am confused, I'm definitely misunderstanding something.
I thought CreatedOn was in the format yyyy-mm-dd hh:mm:ss.ttt. Where does the string come from?
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
September 26, 2014 at 8:16 am
spectra (9/26/2014)
BWFC (9/26/2014)
spectra (9/26/2014)
>>>>Remove the CONVERT and you'll be doing the date range check you want.how do you convert 26/09/2014 to Date ?
then you can use Cast(CreatedOn as date)
No.......you misunderstood my query.... I meant ..how do I cast a String to date ?
e.g Cast('9/26/2014' as date) ....Is it Ok ? Do I need to mention dd/mm/yyyy format here ? if so ..how ?
SELECT CONVERT(datetime, '29/01/2014', 103)
September 29, 2014 at 11:49 pm
>>>SELECT CONVERT(datetime, '29/01/2014', 103)
what does 103 do here ?
September 30, 2014 at 9:44 am
It's the format code. See the CAST and CONVERT page in Books Online.
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
Viewing 5 posts - 16 through 19 (of 19 total)
You must be logged in to reply to this topic. Login to reply