This stored procedure is giving me an error due to truncation on the customerAddress.
Here is my code:
CREATE PROCEDURE insertNewCustomer
-- Add the parameters for the stored procedure here
@customerId char(8),
@customerName varChar(20),
@customerAddress varChar(18),
@zipCode integer
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
INSERT INTO customer (customerId, customerName, customerAddress, zipCode)
VALUES ('Z0999999', 'Larisa Preiser', '3801 W. Temple Avenue', '92335')
END
GO
EXEC insertNewCustomer 1, '', '', 0
Any ideas on how to make it truncate it?
Have you executed the procedure using the EXEC statement?
You must first create the procedure by running the CREATE PROCEDURE command, and then execute it with the EXECUTE command. Please read this tutorial.
http://databases.about.com/od/sqlserver/a/storedprocedure.htm
Try running
Modify your procedure as follows