finding date in data

  • Thread starter Thread starter Selen
  • Start date Start date
S

Selen

Hi,
I am using
select date from table where Convert(char(10),Date,104)>='17.03.2004'

but only comes date which is bigger than 17 ..the other not.

FOr example I cant see 10.04.2004 ..

What is wrong???

Thanks
 
This is because you are comparing ascii values. If you want to go this way,
you should test yyyy.mm.dd.
In this way, you would have a correct behavior with the ">" and "<" signs
Use 102 instead of 104 for the style and test '2004.03.17'

José
 
I want to add something to this -
It will be faster executed if you parse the date in a local variable and
then make the select statement.

Otherwise, you're converting too many times the same value.


Cheers,
Branimir
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top