SQL Server存储过程创建和修改

create proc Get_Data
(
@Del_ID varchar(36)
)
as
select * from Depts where DeptId=@Del_ID

select * from Depts

 

create procedure proc_Insert_Data

@DealerID varchar(36)

as
begin
declare @count int
select @count=(select COUNT(*) from Depts where DeptName=@DealerID)
if(@count>0)
begin
delete from Depts where DeptId=@DealerID
insert into Depts(DeptName) values(@DealerID)
end
else
begin
insert into Depts(DeptName) values(@DealerID)
end
end

posted @ 2016-12-29 10:20  Debugs  阅读(1281)  评论(0编辑  收藏  举报