VS 2010 中的数据库项目无法使用 sys.syscolumns 构建/验证脚本

发布于 01-06 12:57 字数 1026 浏览 2 评论 0原文

我正在尝试使用新创建的脚本构建一个数据库项目,其中包含对 sys.syscolumns 和 sys.sysobjects 的引用。

该错误表明

Error   12  SQL03006: 
View: [dbo].[UtilityTableColumnView] has an unresolved reference to 
    object [sys].[syscolumns].  ...\Schemas\dbo\Views\UtilityTableColumnView.view.sql   

VS 2010 在本地 SQL Server 2008 Developer Edition 上的管理员帐户下运行。

该脚本是

CREATE VIEW [dbo].[UtilityTableColumnView] AS 

    SELECT 
        O.[id] AS TableSystemId, 
        O.[name] AS TableName, 
        C.[id] AS ColumnSystemId, 
        C.[name] AS ColumnName, 
        C.xtype AS ColumnSystemXType, 
        C.typestat AS ColumnSystemTypeStat, 
        C.xusertype AS ColumnSystemXUserType, 
        C.[length] AS ColumnSystemLength, 
        C.xprec AS ColumnSystemXPrec, 
        C.colid AS SystemColId, 
        C.colorder AS SystemColumnOrder 
    FROM 
        sys.syscolumns C INNER JOIN 
        sys.sysobjects O ON O.[id] = C.[id] 
    WHERE 
        O.xtype = 'U'

任何想法如何解决这个问题?

I'm trying to build a database project with just newly created script containing references to sys.syscolumns and sys.sysobjects.

The error says

Error   12  SQL03006: 
View: [dbo].[UtilityTableColumnView] has an unresolved reference to 
    object [sys].[syscolumns].  ...\Schemas\dbo\Views\UtilityTableColumnView.view.sql   

VS 2010 is running under Administrator account who is admin on local SQL server 2008 Developer edition.

The script is

CREATE VIEW [dbo].[UtilityTableColumnView] AS 

    SELECT 
        O.[id] AS TableSystemId, 
        O.[name] AS TableName, 
        C.[id] AS ColumnSystemId, 
        C.[name] AS ColumnName, 
        C.xtype AS ColumnSystemXType, 
        C.typestat AS ColumnSystemTypeStat, 
        C.xusertype AS ColumnSystemXUserType, 
        C.[length] AS ColumnSystemLength, 
        C.xprec AS ColumnSystemXPrec, 
        C.colid AS SystemColId, 
        C.colorder AS SystemColumnOrder 
    FROM 
        sys.syscolumns C INNER JOIN 
        sys.sysobjects O ON O.[id] = C.[id] 
    WHERE 
        O.xtype = 'U'

Any ideas how to resolve this issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无边思念无边月2025-01-13 12:57:23

您必须将系统数据库目录添加到您的项目中。将位于 C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Extensions\SqlServer\2008\DBSchemas 中的架构文件的引用添加到数据库项目引用中。

You have to add the system database catalog to your project. Add a reference to the schema file located in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Extensions\SqlServer\2008\DBSchemas to your db project references.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文