GLCode,
CreatedBy,
ModifiedBy,
CreatedOn,
ModifiedOn
)
VALUES (
Source.PurchaseOrderId,
Source.Quantity,
Source.UnitPrice,
Source.Description,
Source.GLDescriptionId,
Source.GLCode,
Source.CreatedBy,
Source.ModifiedBy,
ISNULL(Source.CreatedOn, GETDATE()),
ISNULL(Source.ModifiedOn, GETDATE())
);
-- Handle deletions if necessary (optional)
-- WHEN NOT MATCHED BY SOURCE THEN
-- DELETE;
-- Return a success message
SELECT 1 AS [Status], 'Items have been added/updated successfully.' AS [Message];
END TRY
BEGIN CATCH
-- Handle any errors
SELECT
ERROR_NUMBER() AS ErrorNumber,
ERROR_SEVERITY() AS ErrorSeverity,
ERROR_STATE() AS ErrorState,
ERROR_PROCEDURE() AS ErrorProcedure,
ERROR_LINE() AS ErrorLine,
ERROR_MESSAGE() AS ErrorMessage;
-- You might want to re-throw the error
-- THROW;
END CATCH
END;
No comments:
Post a Comment