haing error with case

KritiVerma_at_hotmail.com
Date: 10/22/04


Date: Fri, 22 Oct 2004 07:13:02 -0700

I want to write a Query Which takes the input parameters as
StartDate
EndDate
FirstPymtDate
LastpymtDate

Depending on the StartDate and EndDate I have to Check if the FirstPymtDate
and LastpymtDate was withing the Current Quarter. Now if the user send me the
Startdate and Enddate which falls under FirstQuarter I have to check if the
FirstPymtDate and LastpymtDate was with the First Quarter

My Query for FirstPayment looks like

Delcare @StartAndEndDateQuarter dateTime
Declare dtStartDate datetime
Declare FirstPaymentReceivedDate datetime

Set @StartAndEndDateQuarter = Datepart(quarter, @dtStartDate)
--and then return Yes if the FirstPayment Falls under this Quarter
SELECT @FirstPaymentReceivedDate = FirstPymtDate,
                                        @FirstPaymentRcvdDateInCurrentQtr =
case DatePart(quarter, @FirstPymtDate)
When (@StartAndEndDateQuarter = @FirstPaymentRcvdDateInCurrentQtr )
THEN 'Yes'
ELSE 'No'
END)

this Query gives me an Error as

Server: Msg 170, Level 15, State 1, Line 159
Line 159: Incorrect syntax near '='.

Please advice me on this

Thanks
samay



Relevant Pages

  • Question to Check if date falls under selected Quarter
    ... Depending on the StartDate and EndDate I have to Check if the FirstPymtDate ... FirstPymtDate and LastpymtDate was with the First Quarter ...
    (microsoft.public.sqlserver.programming)
  • Re: Question to Check if date falls under selected Quarter
    ... > Depending on the StartDate and EndDate I have to Check if the ... > and LastpymtDate was withing the Current Quarter. ... > FirstPymtDate and LastpymtDate was with the First Quarter ...
    (microsoft.public.sqlserver.programming)
  • RE: haing error with case
    ... > FirstPymtDate ... > Depending on the StartDate and EndDate I have to Check if the FirstPymtDate ... > and LastpymtDate was withing the Current Quarter. ...
    (microsoft.public.sqlserver.programming)