Database Reference
In-Depth Information
cussed for our Customer entity. It writes to both the tbl_customer and the
tbl_address table in our database.
ALTER PROCEDURE prc_save_customer
@email varchar(50)
,@customer_id char(10)
,@firstname varchar(50)
,@lastname varchar(50)
,@homephone varchar(15)
,@workphone varchar(15)
,@mobilephone varchar(15)
,@addresses CustomerAddress ReadOnly
,@customer_objid int OUTPUT
AS
MERGE tbl_customer AS pri_customer
USING
(
SELECT customer_id = @customer_id
)
AS source_customer(customer_id)
ON
(
pri_customer.customer_id =
source_customer.customer_id
)
WHEN NOT MATCHED THEN
INSERT (email,
customer_id,
firstname,
lastname,
homephone,
workphone,
mobilephone)
VALUES (@email,
@customer_id,
@firstname,
@lastname,
@homephone,
@workphone,
@mobilephone)
Search WWH ::




Custom Search