I have a stored procedure (below) that returns the entire table. I am trying to make it so it will return the entire table OR return a certain date range in one Proc. Is this possible or do I need two procs for this? Thanks!
ALTER PROCEDURE [dbo].[GetLeads]
AS
SELECT name
, lastname
, title
, company
, address
, address2
, city
, [state]
, zip
, country
FROM
lead
The above will result in a stored procedure that if you don’t pass a parameter value to it, it’ll return all of the data. If you do pass a parameter value, it’ll only return rows where
lastname = @LastNameSearch.