Skip to content

Settings and activity

2 results found

  1. 47 votes
    Vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    You have left! (?) (thinking…)
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    An error occurred while saving the comment
    SqlNightOwl commented  · 

    I'm more concerned about foreign keys than indexes. Foreign keys imply a build sequence that must be followed. If FK's are in a seperate script then they can be applied last.

    An error occurred while saving the comment
    SqlNightOwl commented  · 

    Treating DRI foreign key constraints as seperate objects will permit tables to be created in any order and then have the foreign keys applied.

    SqlNightOwl supported this idea  · 
  2. 27 votes
    Vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    You have left! (?) (thinking…)
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    For now, you may be able to use a batch file that executes SQL and drops the objects you want re-created before using the SQL Compare Command Line API. Since the objects are dropped, the synch script will generate CREATE scripts instead of alter.

    If you wanted to create everything from scratch, you could drop and recreate the database, which would generate all CREATE scripts.

    I hope this helps for now.

    An error occurred while saving the comment
    SqlNightOwl commented  · 

    I'd change from a drop to a create if not exitsts and then save all scripts as ALTER OBJECT
    such as:
    if object_id(N'schema.procedurename', N'P') is null
    exec sys.sp_executesql 'create schema.procedurename as select 1 as stub';
    go
    alter procedure schema.procedurename

    etc.
    etc.
    ...

    Keeping to an ALTER scenario will leave any security settings in place.

    ALSO: keep/add the GO batch seperator as part of the script.

    SqlNightOwl supported this idea  ·