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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 To find whether given date is between two dates without using year

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-04-20 : 09:56:48
Deva writes "How to find whether the day of given date is between two dates
without using year.
For ex
given date is 10/Apr
two dates are
9/Apr and 12/Apr"

X002548
Not Just a Number

15586 Posts

Posted - 2004-04-20 : 11:26:52
How about



DECLARE @x varchar(10),@y varchar(10),@z varchar(10)
SELECT @x = '10/Apr',@y ='9/Apr', @z ='12/Apr'
SELECT ISNULL('TRUE','FALSE')
WHERE CONVERT(datetime,@x + '/1900')
BETWEEN CONVERT(datetime,@y + '/1900') AND CONVERT(datetime,@z + '/1900')





Brett

8-)
Go to Top of Page
   

- Advertisement -