I have trouble in setting the equal condition on a datetime field after converting it to hh:mm:ss.mmm
:
select top 1 convert(varchar, timestamp, 114) from TEST_TABLE
/* returns a single entry of 11:33:35:000 */
Then I want to find all entries with that timestamp:
select * from TEST_TABLE where convert(varchar, timestamp, 114) = '11:33:35.000'
/* returns nothing */
I've also tried the format of '11:33:35'
(without the mmm) on the R.H.S. of the equal sign, no luck. I'm running these queries in MS SQL Server Management Studio 2008 if that matters. But I need a way that works cross platform as ultimately I'm running a Perl script to perform the query via the DBI module.