sql server - Issue with retrieving DateTime object using Sql -


Looking at the date, 2009-04-30, I want to get all the dates in one line & lt; = 200 / 04/30 and> = 2009/04/30 SQL statements are as follows:

  Selecting date column in the column where the date column & lt; = '2009/4/30' Select a column from some column where the date column & gt; = '2009/4/30'  

The above two statements go on, but the first statement gives down all the dates dated 2009-04-30, it seems that except the date it is db Appears in. Why any thoughts are happening? How do I compare the date part of the date-time object in SQL?

SQL Server dates with store time.

  Select some date from the column where the date column & lt; = '2009/4/30'  

reduces all dates or is equal to 2009/4/30 00:00:00 .

If your date is at least 1/300 seconds, E. G. 2009/4/30 00: 00: 00.003 , it will not be returned

You have to select this type:

  select date from some where the date column & lt; '2009/5/01'  

Or like this:

  Select some date from the column where the date column & lt; DATEADD (day, 1, '2009/4/30')  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -