I am working on bill generation module. I have a stored procedure that enters data in master table and detail table. How can I get the primary key data which is auto incremented and inserted from back end in front end for other purpose from master table.
---Stored Procedure
proc [dbo].[sp_insBillMaster]
@studentId int,
@totalAmount decimal,
@prepearedby varchar(50),
@billNo int output
as
begin
declare @taxPercentage as decimal
declare @grandtotal as decimal
declare @taxAmount as decimal
select @taxPercentage = tax from tbl_tax
select @taxAmount = SUM((@taxPercentage/100)*@totalAmount)
select @grandtotal = SUM(@taxAmount+@totalAmount)
end
begin
insert into tbl_BillMaster (studentId,taxPercentage,totalAmout,taxAmount,grandTotal,date,prepearedby)
values(@studentId,@taxPercentage,@totalAmount,@taxAmount,@grandTotal,getdate(),@prepearedby)
select @billNo= @@identity ...
Go to the complete details ...