Person
| p_id | n_name | l_name | address | city | condition | zip |
Customer
| p_id | reward_points | balance sheet |
Person_PhoneNum
| ppn_id | p_id | number |
The main problem is that I want to try to create a Retrieve stored procedure that can search for any of the Person fields, as well as for the phone number or p_id, but I want it to be able to handle NULL values from the parameters. The following is the stored procedure:
CREATE PROCEDURE RetrieveCust(
@p_id AS varchar(50),
@f_name AS varchar(50),
@l_name AS varchar(50),
@address AS varchar(50),
@city AS varchar(50),
@state AS varchar(50),
@zip AS varchar(50),
@number AS varchar(50))
AS
BEGIN
END
I understand that I need to join tables to match the results, but I don’t know what I could do to handle NULL values. Any help would be awesome!
source
share