Drop schema being included in table create script

I am using sql compare sdk 10 to compare 2 databases and in the source database i have 6 objects that don't exist in the target. Three tables & three sp's, in the target there are 2 tables and 1 schema that does not exist in the source, which is ok I don't want them removed. At the bottom of each script that gets generated there is this,
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
PRINT N'Dropping schemata'
GO
DROP SCHEMA [Test]

I don't want this schema to be dropped and i don't know why it would it has nothing to do with the table or sp being created. If I use sql compare it is not in the generated scripts.

Is there some option that is causing this that I need to include? I'm using the same options that are the default in sql compare in my code.[/code]

Comments

  • dUrosdUros Posts: 21 Bronze 1
    Hello

    Look my post "Exclude Logins, Users and Shemas". I think that is the solution for your problem too.

    Use loop I mentioned:

    .
    .
    If difference.DatabaseObjectType.ToString = "Schema" Then
    difference.Selected = False
    Else
    difference.Selected = True
    .............
    Endif
    .
    .

    Regards
  • dUros wrote:
    Hello

    Look my post "Exclude Logins, Users and Shemas". I think that is the solution for your problem too.

    Use loop I mentioned:

    .
    .
    If difference.DatabaseObjectType.ToString = "Schema" Then
    difference.Selected = False
    Else
    difference.Selected = True
    .............
    Endif
    .
    .

    Regards

    Thanks, yea I figured it out, that was kind of the problem. I was only setting certain differences to selected = false. Thanks.
Sign In or Register to comment.