Bug or oversight? - or am I missing something

BTPBTP Posts: 12 Bronze 2
edited February 3, 2012 3:58AM in SQL Compare Previous Versions
Hi

I have at last managed to get a full license for the products and am now using them.

I have come across a bit of a problem today when deploying some changes to our live environment.

I added a new column to a table and inserted before the last 3 columns ie.


CREATE TABLE [dbo].[JobsArchive]
(
[Id] [int] NOT NULL,
[Description] [nvarchar] (max) COLLATE Latin1_General_CI_AS NULL,
[JobAssetSetId] [int] NOT NULL,
[Category] [nvarchar] (15) COLLATE Latin1_General_CI_AS NOT NULL,
[AccountCodeId] [int] NOT NULL,
[CostCentreId] [int] NULL,
[HealthandSafety] [bit] NOT NULL,
[ContractorId] [int] NULL,
[SpecId] [int] NULL,
[RaisedOn] [datetime] NOT NULL,
[Priority] [int] NOT NULL,
[TargetDate] [datetime] NULL,
[DefectId] [int] NULL,
[SafetyRequired] [bit] NOT NULL CONSTRAINT [DF_JobsArchive_SafetyRequired] DEFAULT ((0)),
[JobSafetySetId] [int] NULL,
[JobCPBSSafetyId] [int] NULL,
[IssuedDate] [datetime] NULL,
[ContractorComplete] [bit] NULL,
[ContractorCompDate] [datetime] NULL,
[FinanceComplete] [bit] NULL,
[FinanceCompDate] [datetime] NULL,
[FinanceComments] [nvarchar] (max) COLLATE Latin1_General_CI_AS NULL,
[InvoiceNo] [varchar] (20) COLLATE Latin1_General_CI_AS NULL,
[Active] [bit] NOT NULL CONSTRAINT [DF_JobsArchive_Active] DEFAULT ((1)),
[DateChanged] [datetime] NOT NULL,
[ChangedBy] [nvarchar] (50) COLLATE Latin1_General_CI_AS NOT NULL
)

Notice the InvoiceNo field

Compare shows no differences , yet if I look at the matching tables etc i see the target as

CREATE TABLE [dbo].[JobsArchive]
(
[Id] [int] NOT NULL,
[Description] [nvarchar] (max) COLLATE Latin1_General_CI_AS NULL,
[JobAssetSetId] [int] NOT NULL,
[Category] [nvarchar] (15) COLLATE Latin1_General_CI_AS NOT NULL,
[AccountCodeId] [int] NOT NULL,
[CostCentreId] [int] NULL,
[HealthandSafety] [bit] NOT NULL,
[ContractorId] [int] NULL,
[SpecId] [int] NULL,
[RaisedOn] [datetime] NOT NULL,
[Priority] [int] NOT NULL,
[TargetDate] [datetime] NULL,
[DefectId] [int] NULL,
[SafetyRequired] [bit] NOT NULL CONSTRAINT [DF_JobsArchive_SafetyRequired] DEFAULT ((0)),
[JobSafetySetId] [int] NULL,
[JobCPBSSafetyId] [int] NULL,
[IssuedDate] [datetime] NULL,
[ContractorComplete] [bit] NULL,
[ContractorCompDate] [datetime] NULL,
[FinanceComplete] [bit] NULL,
[FinanceCompDate] [datetime] NULL,
[FinanceComments] [nvarchar] (max) COLLATE Latin1_General_CI_AS NULL,
[Active] [bit] NOT NULL CONSTRAINT [DF_JobsArchive_Active] DEFAULT ((1)),
[DateChanged] [datetime] NOT NULL,
[ChangedBy] [nvarchar] (50) COLLATE Latin1_General_CI_AS NOT NULL,
[InvoiceNo] [varchar] (20) COLLATE Latin1_General_CI_AS NULL
)
GO

You will notive InvoiceNo is placed at the end!! , it has to be before Active because there is a sproc that copies the Jobs table rows into the Archive using

INSERT dbo.JobsArchive
SELECT * ,
GETDATE() ,
@ChangedBy
FROM dbo.Jobs
WHERE Id = @Id

which now fails until i move the InvoiceNo field to the correct position.

Is this a bug or am i missing something. Why does SQL Compare not show it as a difference ?

P.S.

BTW Your forum is frustratingly slow!!!!!!![/img]
Darren Lawrence
Developer

Comments

  • Have you tried the "Force column order" option in Edit Project/Options/Behavior?

    Let us know if this works for you.

    Kind regards,

    David Atkinson
    Red Gate

    PS Yes, the forum responsiveness can be quite temperamental! Sorry.
    David Atkinson
    Product Manager
    Redgate Software
  • BTPBTP Posts: 12 Bronze 2
    Ah, found it...

    Might i suggest that this should actually be a default.

    I personally dont understand why you wouldnt want to preserve the order!

    Forum got faster shortly after I posted :-)
    Darren Lawrence
    Developer
Sign In or Register to comment.