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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 JOIN current data with UDF data

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 OrigData
FROM Table a
WHERE a.ID = 100

and JOIN/MERGE with

select ID from dbo.fnGetOtherData(100)

Desired result:
OrigData OtherDataCol1 OtherDataCol2
100 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.
Go to Top of Page

rgombina
Constraint Violating Yak Guru

319 Posts

Posted - 2008-12-03 : 18:54:35
I need it PIVOTed (sideways) though. Thanks for the reply.
Go to Top of Page

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.
Go to Top of Page

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
Go to Top of Page
   

- Advertisement -