all groups > sql server dts > june 2007 >
You're in the

sql server dts

group:

Check Table Exist before Drop


Check Table Exist before Drop IronSights
6/28/2007 5:54:10 AM
sql server dts:
I have a DTS package that connects to an Oracle Database and pulls some
information from it with a SELECT query. I then take the results and place
them in a table on the local SQL server.

The DTS package has been wroknig fine for over a year, but there was an over
sight on my part. I had no logic checking to see if the database existed on
the remote server (oracle). The system was offline for an extended period of
time and when the DTS package ran it dropped the table and created it on the
SQL side, but I got no data back from the query. So I eneded up with a blank
database on my SQL server.

I have since placed an Execute SQL Task that runs a simple query against the
remote oracle database to check it exist. If I get data back It goes to the
next step (drop table) if it cannot connect it ends the DTS package and sends
an e-mail.

My question is there has got to be a better way to handle this. For instance
If I wanted to verify there were atleast 100 records in the database before I
proceeeded to the next step. I have the query.

SELECT COUNT(ID)
from table1

How could I set the logic to proceed with completion if >=100 and to fail if
Re: Check Table Exist before Drop Allan Mitchell
6/29/2007 7:04:44 AM
Hello IronSights,

I would typically (in DTS) store this in a Global Variable. In a Script
task I would test the value of the variable and using the DisableStep property
of the Step object I would turn on or off the cirrect path for my workflow.
Much the same way as we do here


http://www.sqldts.com/246.aspx



--

Allan Mitchell
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com |
http://www.konesans.com

[quoted text, click to view]

AddThis Social Bookmark Button