Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Add new column in Stored procedure..

Author  Topic 

GeorgiouE
Starting Member

1 Post

Posted - 2009-04-27 : 10:40:06
Hi, i created one Stored Procedure using subqueries, that returns me the columns below: Item, Description, PurchaseQty, PurchaseAmount, SoldQty, SoldAmount, AdjustmentQty, AdjustmentAmount. The columns are calculated in the stored procedures and are from different tables in the database.
What i need to do is to add one new column in the Stored Procedure named InventoryInQty in which i need to have the result of:
PurchaseQty - SoldQty + AdjustmentQty
Is there a way to do this in the same stored procedure?
Thanks

cat_jesus
Aged Yak Warrior

547 Posts

Posted - 2009-04-27 : 10:44:28


Yes. Just add the column in the select statement.

select <your other columns> , (PurchaseQty - SoldQty + AdjustmentQty) as InventoryInQty
From blah blah blah







An infinite universe is the ultimate cartesian product.
Go to Top of Page
   

- Advertisement -