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
 General SQL Server Forums
 New to SQL Server Programming
 Need a stored procedure to

Author  Topic 

biogem
Starting Member

13 Posts

Posted - 2009-10-06 : 12:03:48
I need a stored procedure to grap the result set from one query and insert that into another query.

select * from workorder where orderedbyname='Donald Frontera' or orderedbyname='Scott Biviano'

SELECT * FROM dbo.vwWorkorderPuchaseOrders WHERE ORDERID = 23546

Once the first query runs, it provide the workorder number for the second query to use. It think a sp will do this for me?

Thanks.

X002548
Not Just a Number

15586 Posts

Posted - 2009-10-06 : 12:40:19
[code]

SELECT *
FROM dbo.vwWorkorderPuchaseOrders
WHERE ORDERID IN ( SELECT ORDERID
FROM workorder
WHERE orderedbyname IN ('Donald Frontera', 'Scott Biviano'))

[/code]


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -