Stored Procedures
Date: 02/23/06
(SQL Server) Keywords: sql
Hi again,
I posted before about how I was coming from Oracle to SQL Server so apologies in advance if this is a stupid question.
I've been using Stored Procedures to return select statements.
What I'm wondering is if they can return data from multiple select statements or variables?
For example
A customer table, and a customer phones table which can have 4 records for the customer.
I want to return customer, phone1, phone2, phone3, phone4
If I just joined the tables I'd get
customer, phone1
customer, phone2 etc.
In Oracle I'd write a function which would get the customer, have a second query to go through the phones table and assign each one to a variable and then return the customer no and the variables.
Can this be done in SQL Server?
Source: http://community.livejournal.com/sqlserver/43823.html