What are the challenges you face when working across database platforms? Take the survey
Options

SQL Compare ALTER Scripts to Database

kberridgekberridge Posts: 3
edited August 7, 2009 7:25AM in SQL Compare Previous Versions
I am trying to setup an environment in which I can edit .sql scripts directly and execute them again the database. To make that doable the scripts need to be ALTERs.

But to do this, I also need to be able to compare the scripts against the database to make sure that nothing has been missed.

Unfortunately, SQL Compare 8.1.0.360 gives an error when comparing against ALTERs. The error is of Medium Severity, Issue is "Non-schema statement was ignored". If I choose to continue and not resolve SQL Compare tells me the script only exists on the database.

I also tried adding an IF EXITS ... DROP at the top of my scripts (I'd rather have alters, but at this point I'll take what I can get). That sort of worked, except I got a Low Severity error, and I really don't want to see 3,000 errors everytime I compare the scripts to the database. I also don't want to have to add IF NOT EXISTS on top of all of my scripts.

Is there a workaround for this or any plans to support it in the future?
Thanks,
Kevin

Comments

  • Options
    This is definitely something we could consider. We've had a lot of requests for IF NOT EXISTS so it's most likely that this would be provided as an option rather than ALTER unless there is strong demand for this. Do you save your schema to a scripts folder?

    We could definitely do with a way of ignoring errors that are 'expected'. Maybe a 'don't show me this again' option should be provided?

    David Atkinson
    Product Manager
    Red Gate Software
    David Atkinson
    Product Manager
    Redgate Software
  • Options
    My plan was to use Red Gate to generate the SQL Scripts to a folder, then do a simple search and replace to update the scripts to ALTERS.

    Two things make ALTERS nice:
    1. They're easier to make from the CREATE statement
    2. They don't screw up SQL's dependency tracking as badly

    That said, I could live with IF EXISTS... DROP

    Thanks for the reply!
Sign In or Register to comment.