Is it possible to pass the WHERE clause to the SELECT statement as a global variable or parameter? If so, what syntax would I use?
For example:
CREATE PROCEDURE [SP_SEARCH] AS
declare @whereclause varchar(255)
set @whereclause = " lastname = 'SMITH' "
SELECT * FROM ATTENDEE
WHERE @whereclause
ORDER BY attendeeid
Note- this gives an error.. but may help describe what I am trying to accomplish...
For example:
CREATE PROCEDURE [SP_SEARCH] AS
declare @whereclause varchar(255)
set @whereclause = " lastname = 'SMITH' "
SELECT * FROM ATTENDEE
WHERE @whereclause
ORDER BY attendeeid
Note- this gives an error.. but may help describe what I am trying to accomplish...