Please tell me what is error in my date comparison sql query

Posted by Rajesh Rolen- DotNet Developer on Stack Overflow See other posts from Stack Overflow or by Rajesh Rolen- DotNet Developer
Published on 2010-04-05T04:54:05Z Indexed on 2010/04/06 1:03 UTC
Read the original article Hit count: 341

Filed under:
|

Please help me to find out error in my SQL query. I have created this query to compare dates

select * from Joinplans jp
where cast(convert(varchar,GETDATE(),103) AS  datetime) BETWEEN    
    CASE(convert(varchar,jp.planstartDate,103) AS datetime) AND
    CASE(convert(varchar,DATEADD(DAY,jp.planDays,jp.planstartDate),103) AS DATETIME)

It's giving me the error:

incorrect near 'AS'

I am using SQL Server 2005.

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server