在SQL server2000中的存储过程中,如何删除表中的一个记录?

如题所述

CREATE PROCEDURE dbo.deleteRecord
@id int --也可以为其它类型,具体看你需要根据什么字段来删
AS
delete from [表名] where ID = @id --也可以为其它字段,具体看你需要根据什么字段来删

GO
温馨提示:答案为网友推荐,仅供参考
第1个回答  2008-12-09
举个例子,比如说删除某个学生的相关信息
if exists(select * from sysobjects where name='del_row')
drop procedure del_row
go
create procedure del_row
@examno char(7)
as
if exists(select * from stumarks where examno=@examno)
begin
delete from stumarks where examno=@examno --这句就是删除一个记录了
end
else
begin
print '不存在你输入的准考证号!请确认'
end
go