Check query contents to stop DTS package | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Check query contents to stop DTS package

This may be pretty basic, but I’m struggling with the answer. Basically, I need to run a query. If I get records in the query, I need to NOT run the rest of the DTS package. If I don’t get any records in the query, I DO need to run the rest of the package. I am not good with ActiveX, and haven’t found any examples that test for a recordset. Thanks for you help. Mike
If you had a T-SQL script, you could use this syntax …<br /><br />IF NOT EXISTS (&lt;query_with_criteria&gt<img src=’/community/emoticons/emotion-5.gif’ alt=’;)‘ /><br />BEGIN<br />&lt;the_rest_of_the_DTS_package&gt;<br />END<br /><br />… but I don’t know the first thing about DTS packages.
quote:Originally posted by mkloster This may be pretty basic, but I’m struggling with the answer. Basically, I need to run a query. If I get records in the query, I need to NOT run the rest of the DTS package. If I don’t get any records in the query, I DO need to run the rest of the package. I am not good with ActiveX, and haven’t found any examples that test for a recordset. Thanks for you help. Mike

If you are trying to implement it in activex script, then you need to google for such relevant articles about using ado objects.
for now, just consider this:
1>IN activex open connection with server, and fire ur t-sql or sp and while executing you can even get the no of records returned.
2>Based on that you can decide on further execution of your script
]]>