Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to call a function of another database???

Status
Not open for further replies.

karthik555

IS-IT--Management
Oct 15, 2002
36
IN
Hi!

I would like to know if I can call a function that is not in the current database. I know we can access tables of another database.

1. Say I have two databases MyDb1 and MyDb2 in same server.
2. There is a function dbo.MyFun1() in MyDb1.
3. I would like to call this function from MyDb2.

Is this possible.

Thanks in advance
Karthik
 
Linked Server is used when the object resids in different server.

In order to call the object in other database, you just need to give full-qualified name for the object.

dbname.dbo.functionname

 
I found it out

you can call like

SELECT MyDb2.dbo.MyFun1() from MyDb1.

Slightly different from how you access a table though.

Thanks any way
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top