Microsoft
Software
Hardware
Network
Question : Select statement between 2 date ranges
Hi Guys
I need a SQL Select statement between 2 date ranges
I have a date Column called 'licenc_ExpiryDate'. It is a datetime column.
An example of a value is 10/08/2010 00:00:00 ie. 10th Aug 2010
The table is called dbo.Licences
The select statement needs to select * between 1st June this year to 31st July next year
If I was to run it this year it will select between 1st June 2010 and 31 July 2011.
If I was to run it next year it will select beween 1st June 2011 and 31 July 2012
Answer : Select statement between 2 date ranges
change the code like below
select * from Licences where licenc_ExpiryDate > = convert(datetime,''+cast(y
ear(Getdat
e()) as varchar)+'0601')
and licenc_ExpiryDate <= convert(datetime,''+cast(y
ear(Getdat
e()+365) as varchar)+'0731')
Random Solutions
How do I get a user ID from a logged in user and include it in my query
Setting up wireless on a Cisco 1811
jQuery or JS - Checkbox set/unset in an array?
How do I update file, save to new location and keep original file as is using Visual Basic 2008?
How to update Hyperlinks in Excel 2003?
Clients not connecting to WSUS
return double array in Delphi call to c++
Gridview RowSelected - Controlling state of other rows
Exchange 2003 and 2010 coexistent - Outlook in 2010 cannot email to 2003
Unable to receive email forwarded into Lotus Domino 8 from Exchange Server 2007