Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sql server giving error : is not a recognized function name

Tags:

sql

sql-server

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?

like image 641
Beginner Avatar asked Jan 03 '12 16:01

Beginner


2 Answers

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.

like image 81
JNK Avatar answered Oct 09 '22 15:10

JNK


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]

like image 38
H27studio Avatar answered Oct 09 '22 13:10

H27studio