Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combine 4 stored procedure queries in mssql 2000 1

Status
Not open for further replies.

Webkins

Programmer
Dec 11, 2008
118
US
I am using a MSSql 2000 stored procedure. I have the following queries which the stored procedure is performing at runtime. Is there a way to combine the below queries into a single query instead of 4 individual queries ?

SET @requested_date = (SELECT requested_date FROM mwo.dbo.mwo where work_order_number = @won)
SET @description = (SELECT [description] FROM mwo.dbo.mwo where work_order_number = @won)
SET @priority = (SELECT priority FROM mwo.dbo.mwo where work_order_number = @won)
SET @attachment_1 = (SELECT attachment_1 FROM mwo.dbo.mwo where work_order_number = @won)

Thanks, This is new to me and I am learning as I go...
 
Code:
Select @requested_date = requested_date,
       @description    = [description],
       @priority       = priority,
       @attachment_1   = attachment_1   
FROM   mwo.dbo.mwo 
where  work_order_number = @won

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top