microsoft / microsoft/sqlmanagementobjects

SMO 172.52.0, skips generation of "hidden" tables.

未关闭
#190 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
C#
星标
143
派生
28
PR 合并指标
30 天内没有已合并 PR

描述

If you create a table with this:

CREATE TABLE [dbo].[sysblah](
	[name] [sysname] NOT NULL,
	[principal_id] [int] NOT NULL,
	[diagram_id] [int] IDENTITY(1,1) NOT NULL,
	[version] [int] NULL,
	[definition] [varbinary](max) NULL
) 

And then create the extended-property to "hide" it, by making it look like a system-table:

EXEC sys.sp_addextendedproperty @name=N'microsoft_database_tools_support', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'sysblah'

If you then use MSDE (or SMO via API), if you script the entire database (i.e. all objects) . . .

Then . . . you'll notice that the resultant script doesn't contain [dbo].[sysblah].

This seems like a bug. The intent is just to hide the table, not treat it as as "system table".

Weirdly, I've just SMO via C#, and even though you include the table in SelectedObjects, it (i) will NOT create the table but (ii) attempts to create the extended-property, which immediately fails because the table does not exist.

Thanks!

Sean

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先使用所示的 CREATE TABLE 和扩展属性语句重现问题,然后在选中该表的情况下,通过 SMO API 为整个数据库和该表编写脚本。跟踪隐藏表或系统表处理的脚本路径,并验证该表会在其扩展属性之前输出;完成标准是两个脚本都能成功创建 [dbo].[sysblah]。

由索引模型根据 Issue 内容生成。

评估

技术栈
csharp, sql
领域
databases
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。