Alter Default Value don't work

Hi @all,

i use the SQL Compare GUI in Version 13.7.7.10021.

So we change default values in some columns on multiple Tables.

Old value = ' ' (one blank)
New value = '' (empty string)

The program creates the following statement

ALTER TABLE [dbo].[Tablename] ADD CONSTRAINT [DF__Tablename__Nam__290129A8] DEFAULT ('') FOR [Columnname]


If i run the script the following error was greated:

Msg 1781, Level 16, State 1, Line 3
A DEFAULT value is already bound to the column.
Msg 1750, Level 16, State 0, Line 3
The restriction or index could not be created. See previous errors.

What can i do to compare the databases?

Greetings
Tagged:

Best Answer

Answers

  • Sergio RSergio R Posts: 610 Rose Gold 5
    User was having issues because he was using a scripts folder as a target to generate a script that he would then deploy against a live database that he couldn't compare against directly: this scripts folder had a system named constraint (which since it's a script folder SC treats as a named constraint). So when he changed the default value, SQL Compare generated an ALTER statement that used a constraint name that was invalid in the database he wanted to deploy to.

    This was resolved by using a SQL Compare snapshot rather than a scripts folder as the target.
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
Sign In or Register to comment.