June 15, 2005 at 1:32 pm
I have date coming to one page as a string in the following format
"May 4 2005 12:00AM"
I need to query one of my tables using this date in combination of other nondate values. How can I convert this date into valid sql server datetime format before I query a database tables
Please help
June 15, 2005 at 2:06 pm
I do not know if the double quotes are used to show us the format or if they are actually passed into SQL Server. If you can replace them with single quotes, it is a fairly straightfoward conversion:
SELECT CONVERT( datetime, 'May 4 2005 12:00AM')
Hope this helps...
I wasn't born stupid - I had to study.
June 15, 2005 at 6:29 pm
I don't think you need to convert it since this would work just fine.
Select *
From YourTable
Where YourDateColumn = 'May 4 2005 12:00AM'
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy