Refactor Tables

caboletcabolet Posts: 8
edited August 7, 2007 6:49AM in SQL Refactor Previous Versions
I find the refactor of tables not very elegant. I have a table that look like this:
CREATE TABLE [dbo].[TblDossier]
(
[DossierId] [int] NOT NULL IDENTITY(1, 1),
[Aandachtspunten] [Text_Description_LargeLength] NULL,
[Opdrachtgever] [varchar](150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ContactpersoonId] [int] NULL,
[Omschrijving] [Text_Description_LargeLength] NULL,
[Toelichting] [Text_Description_LargeLength] NULL,
[Naam] [Text_Name_Varchar250] NULL,
[Wijzigingen] [Text_Description_LargeLength] NULL,
[Referentienummer] [Text_Name_Varchar250] NULL,
[Bronvermelding] [Text_Description_LargeLength] NULL,
[WijzigDatum] [Temporal_Date_Large] NULL,
[AanmaakDatum] [Temporal_Date_Large] NULL
)
When I refactor it, it looks like this:
CREATE TABLE [dbo].[TblDossier]
       (
         [DossierId] [int] NOT NULL
                           IDENTITY(1, 1),
         [Aandachtspunten] [Text_Description_LargeLength] NULL,
         [Opdrachtgever] [varchar](150) COLLATE SQL_Latin1_General_CP1_CI_AS
                                        NULL,
         [ContactpersoonId] [int] NULL,
         [Omschrijving] [Text_Description_LargeLength] NULL,
         [Toelichting] [Text_Description_LargeLength] NULL,
         [Naam] [Text_Name_Varchar250] NULL,
         [Wijzigingen] [Text_Description_LargeLength] COLLATE SQL_Latin1_General_CP1_CI_AS
                                                      NULL,
         [Referentienummer] [Text_Name_Varchar250] NULL,
         [Bronvermelding] [Text_Description_LargeLength] NULL,
         [WijzigDatum] [Temporal_Date_Large] NULL,
         [AanmaakDatum] [Temporal_Date_Large] NULL
       )

I think it is an odd behavior to place the NULL on a new line .

But even then, I would like to have all field coded in one line and be formatted like this.
[size=7]CREATE TABLE [dbo].[TblDossier]
       (
         [DossierId]        [int] DENTITY(1, 1)                                                 NOT NULL,
         [Aandachtspunten]  [Text_Description_LargeLength]                                          NULL,
         [Opdrachtgever]    [varchar](150)                  COLLATE SQL_Latin1_General_CP1_CI_AS    NULL,
         [ContactpersoonId] [int]                                                                   NULL,
         [Omschrijving]     [Text_Description_LargeLength]                                          NULL,
         [Toelichting]      [Text_Description_LargeLength]                                          NULL,
         [Naam]             [Text_Name_Varchar250]                                                  NULL,
         [Wijzigingen]      [Text_Description_LargeLength]  COLLATE SQL_Latin1_General_CP1_CI_AS    NULL,
         [Referentienummer] [Text_Name_Varchar250]                                                  NULL,
         [Bronvermelding]   [Text_Description_LargeLength]                                          NULL,
         [WijzigDatum]      [Temporal_Date_Large]                                                   NULL,
         [AanmaakDatum]     [Temporal_Date_Large]                                                   NULL
       ) [/size]

I try a lot of settings, but with tables it does not even come close.
Any suggestion?
(The forum software don't let me format the code correctly, but the idea is that all items are intended to have all columns in the same place)
Mike
[list][/list]

                

Comments

  • Hi Mike,

    The current version of layout has a single rule for column constraints which judging by the comments we have been receiving will be changed in future versions so that the behaviour you are after is possible.

    Each part of a column definition is placed on a single line. This is why the NOT NULL is being placed on a line separately from the IDENTITY.

    This is intended to help out with complicated column definitions, to make it easy to pick out individual constraints at a glance.

    Regards,

    Jonathan
    Jonathan Watts

    -Project Manager
    -Red Gate Software Ltd
  • I hope this update comes asap
Sign In or Register to comment.