SP with GetDate Input

Last Post 08 Aug 2008 10:02 AM by GoodFella3993. 1 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
GoodFella3993
New Member
New Member

--
08 Aug 2008 09:36 AM
Im trying to make a SP to except GetDate() as a parameter for the end date but im getting an error

exec i2i_merc_MCC_Code_Report '1-1-2000', getdate()

I get this error: Incorrect syntax near ')'.

Any ideas?

Thanks,
Marc

-----------------------------------------------------------------------------------

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


ALTER PROCEDURE i2i_merc_MCC_Code_Report @BeginDate DateTime, @EndDate DateTime


AS
SELECT '' AS WAVE_ID, '' AS TRMT_ID, '' AS CMPGN_ID, COUNT(*) AS RAW_RSP_CT,
'N' AS LGCL_DEL_FG, GetDate() as SRC_SYS_UPD_TS, '' AS SRC_SYS_KY, '' AS WAVE_SRC_SYS_KY,
'' AS TRMT_SRC_SYS_KY, '' AS CRM_CMPGN_SRC_SYS_KY, CM.HP_MCC_Code AS MCC_WAVE_CODE
FROM LEAD_FACT LF INNER JOIN campaign_mapping CM
on LF.campaign_key = CM.campaign_key
WHERE (ISNULL(CM.HP_MCC_CODE,'') <> '') and (LF.create_date BETWEEN @BeginDate AND @EndDate)
GROUP BY CM.HP_MCC_CODE
ORDER BY CM.HP_MCC_CODE DESC


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
GoodFella3993
New Member
New Member

--
08 Aug 2008 10:02 AM
What if i wanted the the option to change the end date if other wise stated.


EX: the input will either be

exec i2i_merc_MCC_Code_Report '1-1-2000', getdate()

OR

exec i2i_merc_MCC_Code_Report '1-1-2000', '1-1-2002'


Acceptable Use Policy
---