Author |
Topic |
marlowkoch
Starting Member
18 Posts |
Posted - 2007-11-16 : 20:56:45
|
Ok everybody. I am new to sql. I have ms sql staging database that pulls data from mysql database. Then once a day I run a ssis package that moves the data to a live database and also creates a flat file that is posted to a ftp site then truncates the table. One problem I am running into is if the mssql staging database has no records the flat file is still created. How do I stop it? |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-11-17 : 01:29:12
|
You can add a step to get row count before creating file. |
 |
|
marlowkoch
Starting Member
18 Posts |
Posted - 2007-11-17 : 11:28:37
|
If I created a data flow task WITH OLE DB SOURCE TO FLAT FILE DESTINATION. Would I add a row count flow item or how would I set this up in ssis? |
 |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-11-17 : 21:42:19
|
Use control flow. |
 |
|
marlowkoch
Starting Member
18 Posts |
Posted - 2007-11-17 : 23:49:45
|
Understand the control flow. The only thing I can't figure out is how do I get the flat file from running with a row count transformation? |
 |
|
marlowkoch
Starting Member
18 Posts |
Posted - 2007-11-18 : 04:33:37
|
Here is what I got:: OLE DB CONNNECTION ==> lOOKUP==>1.PASSES=>>ROW COUNT TRANSFORMATION=>> flat file 2. FAILS ==>> FAILED OLE DB CONNECTION. I can't figure if the row count is zero to stop the flat file from being created? I have the complete process 99% built and am just missing on how do I stop the flat file? |
 |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-11-18 : 20:44:18
|
Can you just stop the package if row count is 0? |
 |
|
igorblackbelt
Constraint Violating Yak Guru
407 Posts |
Posted - 2007-11-19 : 11:16:55
|
Never done this before, but I believe you can have the SSIS package to decide whether or no to proceeded to the next step, (create the flat file) by creating a event handler for the Data Flow task using the OnVariableValueChanged handler. Or go with rmiao and stop the package if the rowcount is 0. |
 |
|
marlowkoch
Starting Member
18 Posts |
Posted - 2007-11-21 : 21:19:28
|
How would I stop the package if the row count is 0? |
 |
|
tm
Posting Yak Master
160 Posts |
Posted - 2007-11-23 : 09:51:23
|
There seems to be work arounds .. Check out this work around .. http://www.msdner.com/dev-archive/65/19-80-653648.shtmThere are other ways to do this such as using a Control Flow >> Execute SQL Task to get the count first, Save the value to a variable, If the variable is none zero continue with export and write to file else do whatever. |
 |
|
marlowkoch
Starting Member
18 Posts |
Posted - 2007-11-28 : 11:49:13
|
Thanks this worked. I really appreciate the help. |
 |
|
|