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.
| Author |
Topic |
|
lfelipe
Starting Member
2 Posts |
Posted - 2009-04-16 : 23:00:19
|
| Hello All,How would I bring in the following record if the date range criteria is to bring in anything falls between '01/01/2008' and '12/31/2008'?RECORD AStartDate = 2006-01-01EndDate = 2009-01-31I'm sure it's something really simply but I can't seem to figure this one out.Thank you in advance for any advice/help. |
|
|
kunal.mehta
Yak Posting Veteran
83 Posts |
Posted - 2009-04-17 : 02:18:11
|
Hi,declare @table1 table (date datetime,Agrid int,chkId int,name varchar(18) ) insert into @table1 values('01/01/2008',102252271,100061, 'abc') insert into @table1 values('12/31/2008',102252271,100842, 'Eli OldName') insert into @table1 values('11-11-2004',102252271,100843, 'Eli OldName') ;select * from @table1 where date between '01/01/2008' and '12/31/2008' Kunal |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-04-17 : 03:41:50
|
| If date column has time tooselect * from @table1 where date >='20080101' and date<'20090101' MadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-04-17 : 10:45:36
|
| [code]select * from @table1 where startdate <='12/31/2008' and enddate>='01/01/2008' [/code] |
 |
|
|
|
|
|
|
|