Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 select data between two date, without day

Author  Topic 

litty2001
Starting Member

1 Post

Posted - 2012-01-09 : 02:36:22
Here I have a table with fields Year int,Month int and many other fields.
I would like select data between two date, without day

An input example:

start month: 9 , start year: 2011
end month: 3, end year: 2012

Quick Reply please.
Thanks in Advance..


litty

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-09 : 02:39:20
something like below

....
where yourdatefiled > = dateadd(mm,@startmonth-1,dateadd(yy,@startyear-1900,0))
and yourdatefield < dateadd(mm,@endmonth-1,dateadd(yy,@endyear-1900,0))


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -