Be the star of a SQL Prompt case study. Learn more.

BUG: Columns not shown in dialog after a CHECK constraint

alicorn68alicorn68 Posts: 9 Bronze 1
edited May 29, 2015 1:44PM in SQL Prompt
I am using SQL Prompt v.6.5.0.323

The expected list of columns in the SQL Prompt dialog does not show when a CHECK constraint is used in a temporary table variable.

Not a show-stopper, by any means. Just a note for some future version. Thanks for the great tool!

Replication:

Create a temporary table variable defined as:

DECLARE @TEST TABLE(
[ID] INT NOT NULL IDENTITY(1,1) PRIMARY KEY CLUSTERED
,[COLUMN1] BIT NOT NULL
,[COLUMN2] BIT NOT NULL CHECK([COLUMN2]=1) -- SOME COMMENT
,[COLUMN3] VARCHAR(50) NOT NULL
);

Attempt to view columns of the temporary table variable:

SELECT [o].<column_dialog>
FROM @TEST [o];

Result:

Only [ID], [COLUMN1], and [COLUMN2] columns are shown in the dialog.

Removing the comment does not allow [COLUMN3] to show in the dialog.

Removing "CHECK([COLUMN2]=1)" alone does allow [COLUMN3] to show in the dialog. Removing the comment at the same time has no additonal effect.

Comments

  • Aaron LAaron L Posts: 596 New member
    Hi,

    Thanks for reporting this - there's a chance we may have already fixed it in 6.5.0.326 - "Columns defined after a table constraint in a table-valued variable are now suggested". If you grab the latest build from check for updates or our website hopefully the columns after the constraint will be suggested.

    If not, please let me know!

    Thanks,
    Aaron.
  • alicorn68alicorn68 Posts: 9 Bronze 1
    As usual, Red Gate is reading my mind. Fixed by v.6.5.0.335.

    Thanks for the great help!
Sign In or Register to comment.