I'm trying to use an IF Statement within my Stored Procedure and it's flagging it in Intellisense as "Incorrect Syntax near 'IF'
Here's the SQL...
WITH
CTE_MEMBER_X_DETAILAS
(
SELECT
[Member_X_Detail].[MEMBER_NBR]AS[CTE_MEMBER_X_DETAIL_MEMBER_NBR],
[Member_X_Detail].[MEMBERMONTHS]AS[CTE_MEMBER_X_DETAIL_MEMBERMONTHS],
[Member_X_Detail].[GROUP_CAT]AS[CTE_MEMBER_X_DETAIL_GROUP_CAT],
[Member_X_Detail].[BUSINESS_UNIT]AS[CTE_MEMBER_X_DETAIL_BUSINESS_UNIT],
[Member_X_Detail].[PREMIUMBILLED]AS[CTE_MEMBER_X_DETAIL_PREMIUMBILLED],
[Member_X_Detail].[CMSPAID]AS[CTE_MEMBER_X_DETAIL_CMSPAID]
FROM[dbo].[Member_X_Detail]
--WHERE
[Member_X_Detail].[ASOFDATE]>=@StartDate
--AND[Member_X_Detail].[ASOFDATE]<=@EndDate
WHERE[Member_X_Detail].[ASOFDATE]>='10/1/2013'
AND[Member_X_Detail].[ASOFDATE]<='12/31/2013'
)
IF @ProviderType = 'I'
BEGIN
Soooo I just want to do some special processing, SELECTs, if the Parameter @ProviderType is indeed equal to 'I'
What am I doing wrong???
Thanks for your review and am hopeful for a reply.
PSULionRP