Tuesday, March 27, 2012

dts question

Hi
as part of a dts package I'd like to check the count of some rows, and if a
threshold is reached then (report success) and move to another task.
It like to do this as a SQL task, is this possible
if ((select count(*) from aTable where someCritiria) > 5)
-- somehow report success and flow to next task
It appears that the only way to do this is to use an activex script task
(using ADO), is that correct.
It seems wrong to resort to ADO when tsql can do itDo you want to stop the execution of package, if the row count falls below
threshold? the you could do it in an execute sql task
IF (some failure condition here)
BEGIN
RAISERROR(...)
END
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Joe Gass" <joegass@.online.nospam> wrote in message
news:%233%23KFoSuFHA.4080@.TK2MSFTNGP12.phx.gbl...
Hi
as part of a dts package I'd like to check the count of some rows, and if a
threshold is reached then (report success) and move to another task.
It like to do this as a SQL task, is this possible
if ((select count(*) from aTable where someCritiria) > 5)
-- somehow report success and flow to next task
It appears that the only way to do this is to use an activex script task
(using ADO), is that correct.
It seems wrong to resort to ADO when tsql can do it|||You don't say what you want to happen if the threshold isn't reached.
If you intend to execute some task conditionally you can do so with a
Dynamic Properties task. Use the result of a query like the following
to set the Task Disabled property for the task you want to be
conditionally executed:
SELECT
CASE WHEN COUNT(*)>5 THEN 0 ELSE -1 END
/* Note 0=False, -1=True */
FROM aTable
WHERE ...
David Portas
SQL Server MVP
--|||Thank you for your helpful replies
It looks like the Dynamic Property task is going to do the trick
Many thanks
Joe
http://www.xwords.co.uk
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1126704974.960369.83200@.g43g2000cwa.googlegroups.com...
> You don't say what you want to happen if the threshold isn't reached.
> If you intend to execute some task conditionally you can do so with a
> Dynamic Properties task. Use the result of a query like the following
> to set the Task Disabled property for the task you want to be
> conditionally executed:
> SELECT
> CASE WHEN COUNT(*)>5 THEN 0 ELSE -1 END
> /* Note 0=False, -1=True */
> FROM aTable
> WHERE ...
> --
> David Portas
> SQL Server MVP
> --
>

No comments:

Post a Comment