user1260827
user1260827

Reputation: 1520

select date column greater then specific

I have the following criteria in where clause:

cat_product.datetime > '2012-09-18 11:24:54'

In the result:

18.09.2012 11:24:54
18.09.2012 11:34:51
18.09.2012 12:07:12

The problem in that the result contain 18.09.2012 11:24:54. Why? In the criteria write > operator not >=.

Upvotes: 2

Views: 2227

Answers (2)

Oleg
Oleg

Reputation: 11

Try this:

cat_product.datetime > fmtdate('yyyy-mm-dd hh:nn:ss','2012-09-18 11:24:54')

Upvotes: 1

Prasanna
Prasanna

Reputation: 4703

Problem with milliseconds. Needs to convert to a format which do not have miliseconds. Such as :

SELECT CONVERT(VARCHAR,GETDATE(),120)

For you, it should be something like:

CONVERT(VARCHAR, cat_product.datetime,120) > '2012-09-18 11:24:54'

Upvotes: 1

Related Questions