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

04-29 23:29