SQL Server - Passing through multiple IDs to a Stored Proc

Asked By David Morakong on 21-Feb-13 12:47 PM
Hi Guys,

I have a Stored Proc that has to return email addresses like this according to the orderType. But is has to return diffeent email addresses for different outlets

So I need to pass through multiple OutletIDs to this proc to get different emails addresses

create table #members_osm(
EMailAddressC varchar(1000) null)
            
 insert into #members_osm(EMailAddressC)
 exec dbo.Get_SuggestedContactPersons @OutletID = '549,538',  @DoEmailOnly = 1


So desired result should be like this:


Please help!! 

Robbe Morris replied to David Morakong on 22-Feb-13 11:36 AM
You'd want to create a user defined function and call it in your select statement.  The UDF would have a varchar(x) as its return parameter.

 select colA, dbo.GetSomeEmailAddresses(orderTypeID), colB, colC 
   from myTable