G
Guest
I am trying to create a proc with a parm @whereclause that will have a value
passed in of one to many policy ids. The parm coming into the proc looks
like this, ('000000000108', '000000000106', '000000000394').
Can you create a proc that accepts the in clause values as a parm?
I did get it to work using the second syntax. I would prefer to use the
first syntax if possible.
First Syntax
CREATE PROCEDURE spMTGetOESEmployerQNXTData
@WhereClause varchar(1000)
AS
--
======================================================================================================
-- Select PolicyPlans
Select rateid,
polid,
planid,
feeid,
remitid,
eobid,
effdate,
termdate,
lastupdate,
updateid,
rategroup,
createid,
createdate,
coveragecodeoption
From planprog.dbo.policyplans
Where Polid In @WhereClause
---
======================================================================================================
--
Second Syntax
Declare @query varchar (5000)
Set @query = 'Select
rateid,
polid,
planid,
feeid,
remitid,
eobid,
effdate,
termdate,
lastupdate,
updateid,
rategroup,
createid,
createdate,
coveragecodeoption
From planprog.dbo.policyplans'
+ ' Where planprog.dbo.policyplans.Polid In '
+ @WhereClause
EXEC (@query)
passed in of one to many policy ids. The parm coming into the proc looks
like this, ('000000000108', '000000000106', '000000000394').
Can you create a proc that accepts the in clause values as a parm?
I did get it to work using the second syntax. I would prefer to use the
first syntax if possible.
First Syntax
CREATE PROCEDURE spMTGetOESEmployerQNXTData
@WhereClause varchar(1000)
AS
--
======================================================================================================
-- Select PolicyPlans
Select rateid,
polid,
planid,
feeid,
remitid,
eobid,
effdate,
termdate,
lastupdate,
updateid,
rategroup,
createid,
createdate,
coveragecodeoption
From planprog.dbo.policyplans
Where Polid In @WhereClause
---
======================================================================================================
--
Second Syntax
Declare @query varchar (5000)
Set @query = 'Select
rateid,
polid,
planid,
feeid,
remitid,
eobid,
effdate,
termdate,
lastupdate,
updateid,
rategroup,
createid,
createdate,
coveragecodeoption
From planprog.dbo.policyplans'
+ ' Where planprog.dbo.policyplans.Polid In '
+ @WhereClause
EXEC (@query)