sp for send the amount from one customer to another in same table
create Table bank
(
B_id int,
Balance Money,
Address varchar(50)
)
alter table bank
add Name varchar(50)
select * from bank
insert into bank values(106,38000,'Gnt','Ankireddy')
--stored procedure for trnasferring amount
create procedure Funds_Transfer
(@srcid int,
@Destid int,
@Balamt money)
as
begin
update bank set Balance=Balance-@Balamt where B_id=@srcid
update bank set Balance=Balance+@Balamt where B_id=@Destid
ENd
create Table bank
(
B_id int,
Balance Money,
Address varchar(50)
)
alter table bank
add Name varchar(50)
select * from bank
insert into bank values(106,38000,'Gnt','Ankireddy')
--stored procedure for trnasferring amount
create procedure Funds_Transfer
(@srcid int,
@Destid int,
@Balamt money)
as
begin
update bank set Balance=Balance-@Balamt where B_id=@srcid
update bank set Balance=Balance+@Balamt where B_id=@Destid
ENd
Exec Funds_Transfer 110,104,2000
No comments:
Post a Comment