ALTER PROCEDURE USP_IDFU_Customers
(@CustomerId int = null,
@Name varchar(30) = null,
@PhoneNo varchar(50)=null,
@EmailId Varchar(30)=null,
@Address varchar(50)=null,
@City varchar(30)=null,
@state varchar(30)=null,
@Pincode varchar(30)=null,
@IsActive bit = null,
@Type char(1)
)
as
if(@Type = 'I')
begin
insert into Customer(Name,PhoneNo,EmailId,Address,City,State,PinCode,IsActive)values(@Name,@PhoneNo,@EmailId,@Address,@City,@State,@PinCode,@IsActive)
end
if(@Type = 'D')
begin
Delete from Customer where CustomerId=@CustomerId
end
if(@Type = 'F')
begin
select * from Customer
end
if(@Type = 'U')
begin
update Customer set Name=@Name,PhoneNo=@PhoneNo,EmailId=@EmailId,Address=@Address,City=@City,State=@State,PinCode=@PinCode,IsActive=@IsActive where CustomerId=@CustomerId
end
(@CustomerId int = null,
@Name varchar(30) = null,
@PhoneNo varchar(50)=null,
@EmailId Varchar(30)=null,
@Address varchar(50)=null,
@City varchar(30)=null,
@state varchar(30)=null,
@Pincode varchar(30)=null,
@IsActive bit = null,
@Type char(1)
)
as
if(@Type = 'I')
begin
insert into Customer(Name,PhoneNo,EmailId,Address,City,State,PinCode,IsActive)values(@Name,@PhoneNo,@EmailId,@Address,@City,@State,@PinCode,@IsActive)
end
if(@Type = 'D')
begin
Delete from Customer where CustomerId=@CustomerId
end
if(@Type = 'F')
begin
select * from Customer
end
if(@Type = 'U')
begin
update Customer set Name=@Name,PhoneNo=@PhoneNo,EmailId=@EmailId,Address=@Address,City=@City,State=@State,PinCode=@PinCode,IsActive=@IsActive where CustomerId=@CustomerId
end
Comments
Post a Comment