在商店过程中添加更多字段 [英] adding more fields in store procedure

查看:95
本文介绍了在商店过程中添加更多字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用商店程序。但这次我需要在我的商店程序中添加两个或更多参数

i已经在我的表中添加了两个字段,现在我想在我的商店程序中添加我的脚本是



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

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

推荐答案

尝试:
ALTER procedure [dbo].[sample002]
(
@id int,
@name varchar(20),
@age int,
@City VARCHAR(100),
@Address VARCHAR(100),
@Salary FLOAT 
)
as
...


首先你提到两个字段但是说明了ree,所以假设有三个新字段要添加。

First you mention two fields but state three, so have assumed there is three new fields to be added.
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)


这篇关于在商店过程中添加更多字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆