I have a stored procedure which outputs @billingInvoiceIDOut
. I want to use it as input in my next stored procedure. Can I just do in my second stored procedure
INSERT INTO table ( billingID ) VALUE (@billingidout)
My first stored procedure:
BEGIN
BEGIN TRANSACTION
BEGIN TRY
SET NOCOUNT ON;
IF NOT EXISTS(SELECT billingInvoiceID
FROM tblBillingInvoice
WHERE billingInvoiceID = @billinginvoiceID)
-- IF @billinginvoiceID = NULL
BEGIN
INSERT INTO [dbo].[tblBillingInvoice
(invoicenumber,versionnumber,patientID,date,
officeID,userID,[tblBillingInvoice].status)
VALUE ((SELECT IDENT_CURRENT('tblbillingInvoice')),1,@patientID,GETDATE(),
@officeID,@userID,1)
SET @billingInvoiceIDOut = (SELECT IDENT_CURRENT('tblbillingInvoice'))
END
END TRY
or do I have to pass this parameter in exec statement as input, as I am running both stored procedures in one master stored procedure?