首页 > 代码库 > SQL Server存储过程创建和修改

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

SQL Server存储过程创建和修改