microsoft / microsoft/sqlmanagementobjects

SMO 172.52.0, skips generation of "hidden" tables.

Open
#190 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
143
Forks
28
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the shown CREATE TABLE and extended-property statements, then script the whole database and the table through the SMO API with the table selected. Trace the scripting path for hidden or system-table handling and verify that the table is emitted before its extended property; done means both scripts create [dbo].[sysblah] successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.