scriptscribe
MIS
Hi,
I'm trying to pass a parameter in a Stored Procedure that has single quotes in it and it's kicking back an error.
Here's my procedure:
and the procedure call:
I used to take this code and manually insert it into the query, as it changes for each facility that I run my report on. Now I want to create a stored procedure that will do this automatically, but because of the single quotes, it won't run.
Thanks,
Mike
I'm trying to pass a parameter in a Stored Procedure that has single quotes in it and it's kicking back an error.
Here's my procedure:
Code:
CREATE PROC [dbo].[uspDSHReport]
@MedicaidCACClause varchar(200)
AS
BEGIN
Declare @SQL VarChar(1000)
Select @SQL = 'SELECT * INTO #KnownMedicaidNoPartB FROM #NoPartB '
Select @SQL = @SQL + 'WHERE (' + @MedicaidCACClause + ')'
Exec ( @SQL)
End
and the procedure call:
Code:
uspDSHReport FinClassCurrent IN ('K','W','WF','WG','WH')
I used to take this code and manually insert it into the query, as it changes for each facility that I run my report on. Now I want to create a stored procedure that will do this automatically, but because of the single quotes, it won't run.
Thanks,
Mike