converting an Access query to a Stored proc

Last Post 07 May 2009 07:43 AM by itmasterw. 0 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
itmasterw
New Member
New Member

--
07 May 2009 07:43 AM
Hi,
I am trying to convert this to its wequivelnt in a stored procedure, but I keep getting an erroe message sysntext error near Then:

here is the Access code:

((IIf(DateAdd("d",-1,DateAdd("m",-2,[Forms]![Switchboard]![Monthly].[Form]![Month] & "/01/" & [Forms]![Switchboard]![Monthly].[Form]![year])) Between [Grp_Start_Date] And IIf(IsNull([Grp_End_Date]),Now(),[Grp_End_Date]),1,0))=1))

Here is my attemped in SQL server:
((Case when DateAdd(day,-1,DateAdd(month,-2,@Month + '/01/' + @Year)) Between [Grp_Start_Date]
And Case when(IsNull([Grp_End_Date],GetDate()) Then 1 Else 0 End) = 1) Else Null END)

Any ideas would really be appreciated
thank you


Acceptable Use Policy
---