Author |
Topic |
aademeo
Starting Member
5 Posts |
Posted - 2014-09-07 : 19:05:01
|
I'm working on creating a stored procedure that does an insert statement into the customers table and inserts the below values: '1000000100', 'Bruins', 'Bruin Way 1', 'Los Angeles', 'CA', '94005', 'USA', 'Joe Bruin', 'jbruin@ucla.edu');Below is what I've developed, but I'm getting an error around SET and am not sure what's missing.CREATE PROCEDURE usp_insertcustomers@cust_id int, @CustName varchar(50), @CustAddress varcar(50), @CustCity varchar(50), @CustState varchar(5), @CustZipcode varchar(10), @CustCountry varchar(50), @CustContact varchar(50), @CustEmail varchar(225)ASINSERT INTO CustomersSETcust_name = @CustName,cust_address = @CustAddress,cust_city = @CustCity,cust_state = @CustState,cust_zip = @CustZipcode,cust_country = @CustCountry,cust_contact = @CustContact,cust_email = @CustEmailWHERE cust_id = @cust_idexec usp_insertcustomers'1000000100', 'Bruins', 'Bruin Way 1', 'Los Angeles', 'CA', '94005', 'USA', 'Joe Bruin', 'jbruin@ucla.edu' |
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2014-09-08 : 05:49:15
|
SET is used for update operation.for insert it should be like thisCREATE PROCEDURE usp_insertcustomers @cust_id int, @CustName varchar(50), @CustAddress varcar(50), @CustCity varchar(50), @CustState varchar(5), @CustZipcode varchar(10), @CustCountry varchar(50), @CustContact varchar(50), @CustEmail varchar(225)ASBEGIN INSERT INTO Customers (cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact, cust_email) VALUES (@CustName, @CustAddress, @CustCity, @CustState, @CustZipcode, @CustCountry, @CustContact, @CustEmail)ENDJaveed Ahmed |
|
|
|
|
|