Our application's DB (SQL Server 2005) has tables for application's metadata. Changes to these metadata tables (I mean insert/update/delete) can be done via GUI interface (not using SSMS).
Most of the time developers change their own copy of database. The question is - how to "merge" these changes to metadata records into one? The problem is that there are no "update" scripts and that rows with the same primary key can mean different things. One possible way is to use tool like SQL Data Compare (from RedGate) to see which rows changed and compare by unique key. The problem can be better understood by example:
CREATE TABLE [dbo].[Type](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Type] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_Type] PRIMARY KEY CLUSTERED ([ID] ASC)
) ON [PRIMARY]
CREATE UNIQUE NONCLUSTERED INDEX [Type] ON [dbo].[Type] ([Type] ASC)
CREATE TABLE [dbo].[Form](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NOT NULL,
[TypeID] [int] NOT NULL,
CONSTRAINT [PK_Form] PRIMARY KEY CLUSTERED ([ID] ASC)
) ON [PRIMARY]
CREATE UNIQUE NONCLUSTERED INDEX [Name] ON [dbo].[Form] ([Name] ASC)
ALTER TABLE [dbo].[Form] WITH CHECK ADD CONSTRAINT [FK_Form_Type] FOREIGN KEY([TypeID]) REFERENCES [dbo].[Type] ([ID])
ALTER TABLE [dbo].[Form] CHECK CONSTRAINT [FK_Form_Type]
First DB contains:
Type
1, 'First type'
2, 'Second type'
Form
1, 'First form', 1
2, 'Second form', 2
Second DB contains:
Type
1, 'First type'
2, 'Third type'
3, 'Second type'
Form
1, 'First form', 1
2, 'Second form', 3
Table "Form" foreign key to table "Type" are different but logically they are the same (as their reference the same Type Name).
How to compare these database in more "intelligent" way? Is there a possibility to do it without Red Gate (or any other 3rd party) tools? Also, how to version metadata when it is being changed not with "update" scripts but via GUI?