Scripting Task

Discussion in 'microsoft.public.sqlserver.dts' started by The Other Mike, May 14, 2010.

  1. I am very new to SSIS 2005

    I have a sql command Select count(*) from table_a. The result is stored in
    a global variable. In a script task, if the record count is 0 then I want
    the flow to go to a task where it sends me an email of "no records found".
    If there are records, then I want to execute a data flow into an excel
    spreadsheet. I had it working in sql 2000, but now I don't know how to
    program it. Could someone help.

    Thanks
    Mike
     
    The Other Mike, May 14, 2010
    #1
    1. Advertisements

  2. The Other Mike

    Todd C Guest

    First of all, I wouldn't use a Script task. A regurlar Execut SQL task would
    probably work as well (unless you need complex manipulation of the connection
    string or command)

    Anyway, create your two Control Flow objects and connect the 1st task, be it
    your Script or Execute SQL to each of those. Right click on one of the green
    connecting arrows and select Edit. Choose "Expression and Constraint" for the
    first option. For the Value, leave it at "Success" and in the Expression,
    enter the following:

    @<My Variable Name> == 0
    or
    @<My Variable Name> > 0
    as appropriate.

    Hope this helps.
     
    Todd C, May 18, 2010
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.