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.
    
        
            
                
                    
                        
                            
                                | Author | 
                                
                                 Topic  | 
                             
                            
                                    | 
                                         rgombina 
                                        Constraint Violating Yak Guru 
                                         
                                        
                                        319 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2008-12-03 : 18:50:15
                                            
  | 
                                             
                                            
                                            | Hi,Is it possible to join a regular select with UDF data? For example,SELECT a.ID AS OrigDataFROM Table aWHERE a.ID = 100and JOIN/MERGE withselect ID from dbo.fnGetOtherData(100)Desired result:OrigData      OtherDataCol1        OtherDataCol2100           otherData1           otherData2....Thanks. | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     Lamprey 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    4614 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-12-03 : 18:53:17
                                          
  | 
                                         
                                        
                                          | I think you want to use the UNION operator.. Probably UNION ALL.  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     rgombina 
                                    Constraint Violating Yak Guru 
                                     
                                    
                                    319 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-12-03 : 18:54:35
                                          
  | 
                                         
                                        
                                          | I need it PIVOTed (sideways) though. Thanks for the reply.  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     rgombina 
                                    Constraint Violating Yak Guru 
                                     
                                    
                                    319 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-12-03 : 19:00:01
                                          
  | 
                                         
                                        
                                          | Just to add - the function is already pivoted so it returns 1 row.  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     rgombina 
                                    Constraint Violating Yak Guru 
                                     
                                    
                                    319 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-12-03 : 19:36:38
                                          
  | 
                                         
                                        
                                          Found it!SELECT * FROM tb_Employees AS E INNER JOIN     dbo.fn_EmployeesInDept('shipping') AS EID   ON E.EmployeeID = EID.EmployeeID  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |