SQL存储过程大全

--增加
create proc usp_insertToText
@productName nvarchar(20),
@unit nvarchar(20),
@usitPrice decimal
as
begin
    insert into TEST1 output inserted.ProductID values(@productName,@unit,@usitPrice)
end

select * from TEST1
usp_insertToText 'Admin','123',60

--删除
create proc usp_updateText
@id int
as
begin
    delete from TEST1 where ProductID=@id
end

usp_updateText @id=4

--修改
create proc usr_updateText
@id int,
@productName nvarchar(20),
@unit nvarchar(20),
@unitPrice decimal
as
begin
    update TEST1 set ProductName=@productName,Unit=@unit,UnitPrice=@unitPrice
    where ProductID=@id
end

select * from TEST1
usr_updateText @productName='admin',@unit='aaa',@unitPrice=66,@id=3

 

posted @ 2016-03-29 23:59  黄者之风  阅读(369)  评论(0编辑  收藏  举报