haing error with case
KritiVerma_at_hotmail.com
Date: 10/22/04
- Next message: SAXXX: "Re: SQL Help"
- Previous message: Adam Machanic: "Re: NO LOCK"
- Next in thread: KritiVerma_at_hotmail.com: "RE: haing error with case"
- Reply: KritiVerma_at_hotmail.com: "RE: haing error with case"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: SAXXX: "Re: SQL Help"
- Previous message: Adam Machanic: "Re: NO LOCK"
- Next in thread: KritiVerma_at_hotmail.com: "RE: haing error with case"
- Reply: KritiVerma_at_hotmail.com: "RE: haing error with case"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|