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

来源:百度知道 编辑:UC知道 时间:2024/06/10 13:30:33

举个例子,比如说删除某个学生的相关信息
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

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

GO