I am trying to create a stored procedure that accepts the 'where' clause as an input parameter. I cannot get SQL to recognize the variable as part of the syntax of the stored procedure. The 'where' clause can be different everytime. As in
"WHERE SlprsnId = '1234' AND DocNmbr = 'A35rt'" or "WHERE SlprsnFNam = 'Frank' AND CustId = '589gyAA' AND SaleAmt > 50".
...
@WhereClause VarChar(100)
AS
SELECT *
FROM ABCDB.dbo.TBLKEY00
@WhereClause
Is this even possible and if so what is the proper syntax??? Thanks for the help.
"WHERE SlprsnId = '1234' AND DocNmbr = 'A35rt'" or "WHERE SlprsnFNam = 'Frank' AND CustId = '589gyAA' AND SaleAmt > 50".
...
@WhereClause VarChar(100)
AS
SELECT *
FROM ABCDB.dbo.TBLKEY00
@WhereClause
Is this even possible and if so what is the proper syntax??? Thanks for the help.