Generating a check for existence...

Brian DonahueBrian Donahue Posts: 6,590 New member
edited April 1, 2003 9:26AM in SQL Compare Previous Versions
Hi John,

A good idea! However, if the object exists, that isn't to say that it
doesn't need to be updated.


Brian Donahue

Technical Support Engineer

Red Gate Software Ltd.

+44 870 1600 037

mailto:[email protected]


"John West" <[email protected]> wrote in message
news:#[email protected]
> In the same vein as my last post, I'd like to have an option where, if an
> object is being created the first time, there's an existence check
included
> in the generated script. This way, if my dependencies are messed up and I
> have to run the script to create views, sps and functions several times,
it
> won't try to recreate the ones that were successful the previous time.
>
> Thanks,
> John
>
>

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    You can do those kind of whizzy things if you've bought the SQL Toolkit. :-)

    "Chris Tybur" <[email protected]> wrote in message
    news:[email protected]
    > Hi John.
    >
    > Just thought I'd offer a comment on what you are trying to do, since I
    > deal with dependency issues as well. I wrote a utility that uses SQL
    > Compare to generate a huge script to recreate an entire database. I
    > determine ahead of time how many times it would need to be executed to
    > create all the objects (we only deal with tables, views, SP's and
    > UDF's). The utility then chops off the last few lines of generated
    > script which roll back all changes if an error occurs, then it runs the
    > script x number of times. If an object already exists the given T-SQL
    > command fails, but the script carries on and all changes are committed.
    > It works fairly well at refreshing all dependency information.
    >
    > Chris
    >
    > John West wrote:
    >
    > >In the same vein as my last post, I'd like to have an option where, if an
    > >object is being created the first time, there's an existence check
    included
    > >in the generated script. This way, if my dependencies are messed up and
    I
    > >have to run the script to create views, sps and functions several times,
    it
    > >won't try to recreate the ones that were successful the previous time.
    > >
    > >Thanks,
    > >John
    > >
    > >
    >
This discussion has been closed.