简单问题,在线等待!!!!

TracyDang 2003-09-30 09:56:25
表Products 里有如下字段:ID int pk,Name varchar(40),Price Money,Description
varchar(256) = '',Available bit = 1
请问高手如何建立2个存储过程DeleteProduct(从表中删除一条记录)\UpdateProduct(更新表)?谢谢!!!
...全文
26 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
yujohny 2003-09-30
  • 打赏
  • 举报
回复
--删除
CREATE PROC DeleteProduct(@ID INT)
AS
DELETE Products WHERE ID=@ID

--更新
CREATE PROC UpdateProduct(@ID INT)
AS
UPDATE Products
SET Name=……,Price=……,Description=……,Available=……
WHERE ID=@ID
txlicenhe 2003-09-30
  • 打赏
  • 举报
回复
create proc DeleteProduct @id int
as
delete Products where id=@id
go

create proc UpdateProduct
@id int,@name varchar(40),@price money,@Description varchar(256),@Available bit
as
update Products set [name]=@name,price=@price,[Description]=@Description,Available=@Available where id=@id
go
aierong 2003-09-30
  • 打赏
  • 举报
回复
CREATE PROC DeleteProduct
@id int
AS
delete from Products
where ID =@id







CREATE PROC UpdateProduct
@id int,@name varchar(40)
AS
update Products
set Name=@name
where id=@id



不太明白你的意思,先简单的写了2个过程
pengdali 2003-09-30
  • 打赏
  • 举报
回复
create proc DeleteProduct
@id int
as
delete Products where id=@id
go

create proc UpdateProduct
@id int,@name varchar(40),@price money,@Description varchar(256),@Available bit
as
update Products set [name]=@name,price=@price,[Description]=@Description,Available=@Available where id=@id
go

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧