我有一个包含实体的表:reg_num、user_name、phone_num、designation
我想编写存储过程,只需输入 reg_num 值即可删除一行的全部数据。
create proc del @reg_num nchar(10)
as
delete reg_num, user_name, phone_num, designation from nameTable
where reg_num = @reg_num
我有一个包含实体的表:reg_num、user_name、phone_num、designation
我想编写存储过程,只需输入 reg_num 值即可删除一行的全部数据。
create proc del @reg_num nchar(10)
as
delete reg_num, user_name, phone_num, designation from nameTable
where reg_num = @reg_num
您没有为删除语句指定列:
create proc del @reg_num nchar(10)
as
delete from nameTable
where reg_num = @reg_num
您只需要指定表名,不需要列出的列。
IE
create proc del @reg_num nchar(10)
as
delete from nameTable
where reg_num = @reg_num
删除时,您必须遵循如下语法:
declare @regNum int
set @regnum = 1
delete from [table] where regnum = @regnum
在存储过程中,您需要这样做:
create procedure test (@regnum int) as
begin
delete from [table] where regnum = @regnum
end