sql server 报错:不是公认的函数名
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8715120/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
sql server giving error : is not a recognized function name
提问by Beginner
I created a backup of a database on sql server 200. I created a new database in sql server 2008 r2.
我在 sql server 200 上创建了一个数据库的备份。我在 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?
我认为这可能是一个安全问题,因为 dbo 下的用户拥有的架构不包含 antyhing?
回答by JNK
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:
如果视图在Database2
,函数也在,Database1
那么你需要使用三部分名称来完全限定函数:
Database1.dbo.[Function_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.
除非您另外指定,否则假定视图中的所有对象与视图位于同一数据库中。
回答by H27studio
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]
视图与函数在同一个数据库上吗?如果不是,则需要将其称为[database_name].dbo.[function_name]