How can we help you today? How can we help you today?

alter table [tname] add or drop constraint

While formatting, it seems to skip over table constraints
ALTER TABLE [dbo].[Cube] 
ADD CONSTRAINT
PK_Cube PRIMARY KEY CLUSTERED 
(TrendStart, TrendEnd, Level1, Level2, Level3, Level4, CaptureDate)

becomes
ALTER TABLE [dbo].[Cube] 
ADD CONSTRAINT
PK_Cube PRIMARY KEY CLUSTERED 
(TrendStart, TrendEnd, Level1, Level2, Level3, Level4, CaptureDate)

ALTER is at the correct level of indentation, but the rest remained untouched.

To give you an idea of my style settings, here's a create table statement from the same script, following the same formatting operation:
CREATE TABLE #DatabaseDates
            (
                CaptureDate datetime NOT NULL
              , Level1 varchar(50) NOT NULL
              , Level2 varchar(50) NOT NULL
              , Level3 varchar(100) NOT NULL
              , Level4 varchar(100) NOT NULL
            )

So I would think the add constraint should look more like this:
ALTER TABLE [dbo].[Cube] 
        ADD CONSTRAINT PK_Cube PRIMARY KEY CLUSTERED 
            (
                TrendStart
              , TrendEnd
              , Level1
              , Level2
              , Level3
              , Level4
              , CaptureDate
            )
majahanson311
0

Comments

1 comment

  • Andras B
    While formatting, it seems to skip over table constraints
    ALTER TABLE [dbo].[Cube] 
    ADD CONSTRAINT
    PK_Cube PRIMARY KEY CLUSTERED 
    (TrendStart, TrendEnd, Level1, Level2, Level3, Level4, CaptureDate)
    

    becomes
    ALTER TABLE [dbo].[Cube] 
    ADD CONSTRAINT
    PK_Cube PRIMARY KEY CLUSTERED 
    (TrendStart, TrendEnd, Level1, Level2, Level3, Level4, CaptureDate)
    

    ALTER is at the correct level of indentation, but the rest remained untouched.

    To give you an idea of my style settings, here's a create table statement from the same script, following the same formatting operation:
    CREATE TABLE #DatabaseDates
                (
                    CaptureDate datetime NOT NULL
                  , Level1 varchar(50) NOT NULL
                  , Level2 varchar(50) NOT NULL
                  , Level3 varchar(100) NOT NULL
                  , Level4 varchar(100) NOT NULL
                )
    

    So I would think the add constraint should look more like this:
    ALTER TABLE [dbo].[Cube] 
            ADD CONSTRAINT PK_Cube PRIMARY KEY CLUSTERED 
                (
                    TrendStart
                  , TrendEnd
                  , Level1
                  , Level2
                  , Level3
                  , Level4
                  , CaptureDate
                )
    

    Hi,

    many thanks for reporting this. At the moment we have not yet finished our support for alter table statements. We are working on it, and it should be imporved for the final release.

    Regards,
    Andras
    Andras B
    0

Add comment

Please sign in to leave a comment.