Beginner
Beginner

Reputation: 29533

sql server giving error : is not a recognized function name

I created a backup of a database on sql server 200. I created a new database in sql server 2008 r2.

Now when i run a view i get the error :

'function_name' is not a recognized function name.

The function is there And i can run it using

   SELECT [dbo].[function_name] (
   'hjh')
GO


 SELECT dbo.function_name('kjk')

Why would this problem occur when it is functioning correctly originally?

EDIT:

I think it may be a security issue as schemas owned by the user under dbo does not contain antyhing?

Upvotes: 10

Views: 34702

Answers (2)

H27studio
H27studio

Reputation: 467

Is the view on the same database as the function? If they are not, you need to call it like [database_name].dbo.[function_name]

Upvotes: 3

JNK
JNK

Reputation: 65147

Make sure you are executing it in the correct database context.

If the view is in Database2 and the function is in Database1 then you will need to fully qualify the function using the three part name:

Database1.dbo.[Function_Name]

All objects in a view are assumed to be in the same database as the view unless you specify otherwise.

Upvotes: 18

Related Questions