10

I have a user defined function in a different database than the one i am querying from. Is there a way to access the function such as a fully qualified name or something similar in SQL? I am trying to do this

[dbo].[EscalationManagementSystem].fncCVUnix2DateTZ(...

But i get an error saying that it cannot find the column "dbo" or the user defined function "dbo.EscalationManagemntSystem.fncCVUnix2DateTZ". Is my syntax wrong?

0

2 Answers 2

16

The proper format is Database.Schema.Object, so you would have:

[EscalationManagementSystem].[dbo].[fncCVUnix2DateTZ](...

Sign up to request clarification or add additional context in comments.

Comments

3

Every time you need to access objects from another db you should use something called the "four part name convention" which is:

SERVER.DATABASE.SCHEMA.OBJECT

1 Comment

You only need the server name if going to a different server than what the current database is located on; that is the only time you should specify the server name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.