I created a stored procedure in SQL Server. The stored procedure subtracts two columns in the same table. How do I insert this stored procedure data into a Inventory column of the dbo.Store table? The stored procedure is:
ALTER PROCEDURE [dbo].[sp.StoreBilling] AS BEGIN SET NOCOUNT ON; DECLARE @Stock decimal(10,2)=0.00 DECLARE @Spoilage decimal(10,2)=0.00 SELECT A.Stock, A.Spoilage, A.Stock-A.Spoilage AS Inventory FROM dbo.Store AS A END
Advertisement
Answer
You can create a table, or use an existing one easily.
create table #BillingResult ( Stock int , Spoilage int , Inventory int ) insert #BillingResult exec [dbo].[sp.StoreBilling]