最佳答案
我已经创建了一个访问 [INFORMATION_SCHEMA].[TABLES]
视图的 UDF:
CREATE FUNCTION [dbo].[CountTables]
(
@name sysname
)
RETURNS INT
AS
BEGIN
RETURN
(
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @name
);
END
在 VisualStudio 中,视图的架构和名称都标记为警告:
SQL71502: Function: [ dbo ] . [ CountTables ]有一个未解析的对象引用[ INFORATION _ SCHEMA ] . [ TABLES ]。
我仍然可以毫无问题地发布数据库项目,而且 UDF 似乎运行正确。IntelliSense 为我填充了视图的名称,所以它似乎没有问题。
I also tried changing the implementation to use sys.objects
instead of this view, but I was given the same warning for this view as well.
我如何解决这个警告?