Hi,
I am in a process of upgrading database. I am using SQL script generated by
enterprise manager, which is read by executed by VB in windows installer
project.
It sets up the entire database only after dropping all tables.
I need each and every table to be checked if it already exists, it should
skip the creation of that table. If that table does not exist, only then it
should create that table.
'Generate SQL script' toll of Enterprise managaer gives just 2 options, if
you donot select DROP objects option, it tries to create all tables without
checking of their existence. If you do select DROP objects option, It drop
each table before it creates new one(loss of data).
Is there an option to avoid this situation ?
Means, any way to create a SQL script which checks wheather the table
exists, If it exists, it does nnot try to create it, otherwise it creates the
table.
Thnx
"BONTZ" <BONTZ@.discussions.microsoft.com> wrote in message
news:6670BE8F-7370-422F-98DB-043DCA3511AA@.microsoft.com...
> I am in a process of upgrading database. I am using SQL script generated
by
> enterprise manager, which is read by executed by VB in windows installer
> project.
> It sets up the entire database only after dropping all tables.
> I need each and every table to be checked if it already exists, it
should
> skip the creation of that table. If that table does not exist, only then
it
> should create that table.
> 'Generate SQL script' toll of Enterprise managaer gives just 2 options,
if
> you donot select DROP objects option, it tries to create all tables
without
> checking of their existence. If you do select DROP objects option, It drop
> each table before it creates new one(loss of data).
> Is there an option to avoid this situation ?
> Means, any way to create a SQL script which checks wheather the table
> exists, If it exists, it does nnot try to create it, otherwise it creates
the
> table.
Without writing the additional code to validate the tables, the CREATE TABLE
statements will simply fail for existing tables -- perhaps just ignore the
errors for those tables?
Steve
|||Hi Steve,
Thnx for the response.
I can ignore the errros.. but I am not running script through query
analyzer. As mentioned before, I am running this script through windows
installer program, which rollsback the installation of my application in case
of any error.
I was wondering that there should be an option provided by enterprise
manager which just checks weather table is already present before creating
one.
Regards
"Steve Thompson" wrote:
> "BONTZ" <BONTZ@.discussions.microsoft.com> wrote in message
> news:6670BE8F-7370-422F-98DB-043DCA3511AA@.microsoft.com...
> by
> should
> it
> if
> without
> the
> Without writing the additional code to validate the tables, the CREATE TABLE
> statements will simply fail for existing tables -- perhaps just ignore the
> errors for those tables?
> Steve
>
>
|||Hi,
You could add your own logic, if you use the script wizard to create the
table create and table drop statements -- check out the way the logic
qualifies whether the table exists before the DROP statement is run.
It will require additional coding, but a possible way to enhance your
script.
Steve
"BONTZ" <BONTZ@.discussions.microsoft.com> wrote in message
news:4332D573-F257-425D-8E80-AADBACAD95B4@.microsoft.com...
> Hi Steve,
> Thnx for the response.
> I can ignore the errros.. but I am not running script through query
> analyzer. As mentioned before, I am running this script through windows
> installer program, which rollsback the installation of my application in
case[vbcol=seagreen]
> of any error.
> I was wondering that there should be an option provided by enterprise
> manager which just checks weather table is already present before creating
> one.
> Regards
>
> "Steve Thompson" wrote:
generated[vbcol=seagreen]
installer[vbcol=seagreen]
then[vbcol=seagreen]
options,[vbcol=seagreen]
drop[vbcol=seagreen]
creates[vbcol=seagreen]
TABLE[vbcol=seagreen]
the[vbcol=seagreen]
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment