Click here to Skip to main content
15,905,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using store procedure.but this time i need to add two and more parameters in my store procedure
i have already added two fields in my table and now i want to add inside my store procedure my script is

SQL
CREATE procedure [dbo].[sample002]
(
@id int,
@name varchar(20),
@age int

)
as
insert into sample001(id,name,age) values(@id,@name,@age)



and now i want to add city and address and salary. please help me to make it understand
Posted
Updated 21-Nov-14 19:58pm
v2

TRY:
SQL
ALTER procedure [dbo].[sample002]
(
@id int,
@name varchar(20),
@age int,
@City VARCHAR(100),
@Address VARCHAR(100),
@Salary FLOAT 
)
as
...
 
Share this answer
 
First you mention two fields but state three, so have assumed there is three new fields to be added.
SQL
Alter procedure [dbo].[sample002]
(
@id int,
@name varchar(20),
@age int,
@city varchar(20)  -- or whatever the field size is
@address varchar(50).  -- as above
@salary numeric(18,4).   -- as above
)
as
insert into sample001(id,name,age.city,address,salary) values(@id,@name,@age,@city, @address, @salary)
 
Share this answer
 
v3
Comments
RossMW 22-Nov-14 2:26am    
Thanks. Painful limitation of try to write code etc on a damn iPad. Always end up with stupid mistakes!!!
faizyab 2009 22-Nov-14 2:31am    
thank you RossMW

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900