December 30, 2014 at 2:49 am
I have a datetime column which contains dates such as
2014-12-28 08:52:02.920
The database collation is "Latin1_General_CI_AS"
how do I write "select * from table where datetimecolumn = ..." ?
whatever I tried so far doesn't work.
thanks
-Michael
December 30, 2014 at 2:51 am
SELECT * FROM TableName WHERE DateTimeColumn = '2014-12-28 08:52:02.920'
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
December 30, 2014 at 11:01 am
GilaMonster (12/30/2014)
SELECT * FROM TableName WHERE DateTimeColumn = '2014-12-28 08:52:02.920'
Msg 242, Level 16, State 3, Line 1
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
December 30, 2014 at 11:04 am
veloopity (12/30/2014)
GilaMonster (12/30/2014)
SELECT * FROM TableName WHERE DateTimeColumn = '2014-12-28 08:52:02.920'Msg 242, Level 16, State 3, Line 1
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
Take out the dashes.
SELECT * FROM TableName WHERE DateTimeColumn = '20141228 08:52:02.920'
December 30, 2014 at 11:06 am
ah, that works !! 1000 thanks
-mpe
🙂
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply