Hi there,
I currently have TSQL code that queries from 2 separate databases residing on same the MS SQL Server instance.
My question is: What's the syntax to call a function that's on a separate database?
Current Code
I am aware that ds2 is currently referring to a table on the separate database.
How would I refer to a function that's on that same database?
Any advice or suggestion would be very welcome. Thanks!
Regards.
I currently have TSQL code that queries from 2 separate databases residing on same the MS SQL Server instance.
My question is: What's the syntax to call a function that's on a separate database?
Current Code
Code:
-- Data Source #1
-- -- -- -- -- --
SELECT ds1.fname,
ds1.lname,
ds1.email,
-- Data Source #2
-- -- -- -- -- --
ds2.maritalStatus,
ds2.address,
-- **************************************
-- call function from 2nd database source
-- SYNTAX???
dbo.functNumChildren(ds2.employeeID)
-- **************************************
FROM ds1 INNER JOIN
-- make reference to separate database
OPENDATASOURCE( 'SQLOLEDB',
'Data Source=Server;
User ID=UID;
Password=PWD').DATASOURCE2DB.dbo.TBLNAME AS ds2
-- the field that connects the two database sources
ON ds1.employeeID = ds2.employeeID
I am aware that ds2 is currently referring to a table on the separate database.
How would I refer to a function that's on that same database?
Any advice or suggestion would be very welcome. Thanks!
Regards.