• sharonsql2013 (9/27/2013)


    Output must be : If I pass 10-10-2012 as input then it should check between Anniversarystartdate and

    AnniversaryEndDate. If it falls in that then it should display that else Null

    I'm taking a shot in the dark here. But is this what you are looking for?

    declare @DateInput Date = '2012-10-10'

    select anniversaryNumber,

    case when @DateInput between AnniversaryStartDate and AnniversaryEndDate then AnniversaryStartDate else null end StartDate,

    case when @DateInput between AnniversaryStartDate and AnniversaryEndDate then AnniversaryEndDate else null end EndDate

    from AnniversaryData

    __________________________________________________________________________________________________________
    How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/