dnlnln / generate-sql-merge

Generate SQL MERGE statements with Table data
MIT License
337 stars 151 forks source link

SSMS Issue, or..? #76

Closed davimack closed 3 years ago

davimack commented 3 years ago

When SQL Server Management Studio is set to text output in the results pane, nothing is generated, regardless of @results_to_text. image

When SSMS is set to send results to grid, I get xml or text results no problem.

This feels like an SSMS issue, but ...?

dnlnln commented 3 years ago

That's odd, doesn't happen on my machine (I see the MERGE statement between line 10-12). Are you specifying any other params other than @table_name / @schema?

davimack commented 3 years ago

I apologize - that's a particularly horrible bug request, with nowhere near enough detail. Please close it and I'll request a re-open if I encounter the issue again.

To answer your question, though, my command would have been one of these two: exec sp_generate_merge @table_name='Domains', @include_use_db=0, @nologo=1, @cols_to_include="'DomainID', 'ParentDomainID','DomainName','DomainDescription','AvailableToAutomation'" or exec sp_generate_merge @table_name='Systems', @include_use_db=0, @nologo=1

The first table's DDL: CREATE TABLE [dbo].[Domains] ( [DomainID] INT IDENTITY (1, 1) NOT NULL, [ParentDomainID] INT NULL, [DomainName] VARCHAR (32) NOT NULL, [DomainDescription] VARCHAR (255) NULL, [AutomationHoldDate] DATETIME NULL, [AvailableToAutomation] BIT DEFAULT ((0)) NOT NULL, [TestingReleaseDate1] DATETIME NULL, [TestingReleaseDate2] DATETIME NULL, [TestingReleaseDate1Color] VARCHAR (16) NULL, [TestingReleaseDate2Color] VARCHAR (16) NULL, [AIOQCompleteDate] DATETIME NULL, [AIOQCompleteDateColor] VARCHAR (16) NULL, [TestingRelease1ScheduleLink] VARCHAR (32) NULL, [TestingRelease2ScheduleLink] VARCHAR (32) NULL, [AIOQCompleteScheduleLink] VARCHAR (32) NULL, [PQStartDate] DATETIME NULL, [PQStartDateColor] VARCHAR (16) NULL, [PQStartScheduleLink] VARCHAR (32) NULL, CONSTRAINT [pkc_Domains] PRIMARY KEY CLUSTERED ([DomainID] ASC), CONSTRAINT [fk_ParentDomainID@Domains] FOREIGN KEY ([ParentDomainID]) REFERENCES [dbo].[Domains] ([DomainID]), CONSTRAINT [uni_DomainName@Domains] UNIQUE NONCLUSTERED ([DomainName] ASC) );

Second table's DDL: CREATE TABLE [dbo].[Systems] ( [SystemID] INT IDENTITY (1, 1) NOT NULL, [SystemName] VARCHAR (32) NOT NULL, [SystemDescription] VARCHAR (128) NOT NULL, [DomainID] INT NULL, CONSTRAINT [pkn_SystemID] PRIMARY KEY NONCLUSTERED ([SystemID] ASC), CONSTRAINT [fk_DomainID@Systems] FOREIGN KEY ([DomainID]) REFERENCES [dbo].[Domains] ([DomainID]), CONSTRAINT [uci_SystemName@Systems] UNIQUE CLUSTERED ([SystemName] ASC) );

My thought at this time is that it's an issue in SSMS. I say this because the names are probably very bad ideas (e.g. I've one named Tasks which screws up the SSMS diagramming tool).

In any event. I promise to be better at documenting next time.

dnlnln commented 3 years ago

No worries at all David, appreciate the follow-up. Interestingly, I still can't reproduce the error with the code provided, so perhaps there is a client issue involved (e.g. SSMS configuration and/or SQL client-specific issue). Do let me know if it continues to be problematic, however.