Devender Naik


Hello everyone,

I have a very little experience in SSIS bit a good experience in DTS. Now i am working for a solution to implement.

If you can let me know a feasible solution and the steps for the following task.

The task is as follows:
1. Have a Log Table where all the transactions are stored from various tables.
2. This table has the table name, the primary Key feild name and the rowid, of the data which has to be pulled.

3. After transforming these data from these tables we need to write to seperate Text files. Each table will have a seperate text file
4. Need to implement a error log for each Record moved or failed.

Thanks in advance..

Regards,
Dev.





Re: Please help me SSIS...

MatthewRoche


As you've probbaly seen already, the toolset in SSIS is much larger and much different than is DTS, but once you get your hands dirty, you'll probably never want to go back.

With that said, can you please share a little more data about the "transforming these data from these tables" from your post Depending on the details of what you need to do, different solutions may be feasible.







Re: Please help me SSIS...

dev15`4534345677

Hi Mathew,

Thanx for the quick Reply.

There is not much transformation here... Just need to add concatinate some text to the existing one coloumn, apart from that it;s a straight move/apend to the text files.

Hope this helps you....

regards,

Dev







Re: Please help me SSIS...

MatthewRoche

Are the source and destination tables in the same database, different databses or on different servers




Re: Please help me SSIS...

dev15`4534345677

Hi Mathew,

I appreciate your patience...

the source is in the database and the Destination will be a shared folder to put the Text files. Source DB is on the same server and has all the tables in the same DB.

Regards,

Dev






Re: Please help me SSIS...

MatthewRoche

Sorry about that - I need to beg your patience, since I missed the "text files as destinations" point when I was reading your original post.

Do the source tables (and from there, the destination text files) share a common schema, or do they have different columns and data types






Re: Please help me SSIS...

dev15`4534345677

hi mathew,

It's the same schema and the datatype.

regds,

dev






Re: Please help me SSIS...

dev15`4534345677

Hi Mathew,

the destination file format is like tabbed data of coloumns. As it is we get it from the source.

rgds,

dev






Re: Please help me SSIS...

dev15`4534345677

hi mathew,

once we get the rows from the log table ... after processing we need to change the status of the record in the log table as well. And incase of error we need to log the error to another table. and proceed to other records.

So in the log table we will have the pointer from which table we need to get the data.....

rgds,

dev






Re: Please help me SSIS...

MatthewRoche

(Sorry for the delay in responding - the real world has been intruding today )

Thanks for all of the additional information!

Based on what I know, this is the basic approach that I would look at for your SSIS package:

  1. Add these string variables to your package:
    1. LogFileName
    2. SourceTableName
    3. SqlQuery
  2. Add a Flat File connection manager to your package. Add an expression to its ConnectionString property so that the property value is set by the LogFileName variable
  3. Add an OLE DB (or whatever is appropriate) connection manager to your package, and configure it to reference your source database.
  4. Edit the properties of the SqlQuery variable so that it is evaluated as an expression and its expression yields a SQL SELECT statement that selects records from the log table identified by the SourceTableName variable. Something like this might work as a starting point for an expression - "SELECT * FROM " + @[User:Tongue TiedourceTableName]
  5. Edit the properties of the LogFileName variable so that it is evaluated as an expression and its expression yields a file path to the log file to use for that table.
  6. Add a Foreach Loop container to your control flow, looping through the source tables feeding into the log table and storing the table name in the SourceTableName variable as the loop enumerator.
  7. With this setup, for each source table being enumerated, the SqlQuery variable will contain a SQL SELECT statement to query from the "current" source table, and the LogFileName variable will contain a file path for a log file into which records from the current table should be dumped. This is probably the most important conceptual leap moving from DTS.
  8. Within the Foreach Loop container, add a Data Flow task.
  9. Inside the Data Flow task, add the following components:
    1. An OLE DB (or whatever is appropriate) data source that uses the connection manager from step 3, and uses as its source query the SqlQuery variable from step 1.3
    2. Whatever transformations (derived columns, conditional splits, etc.) are necessary to implement your core logic.
    3. A Flat File destination that uses the conneciton manager from step 2 (remember - the flat file connection manager uses an expression with the LogFileName variable as its connection string, so it will "automatically" point to the correct flat file path if you've set it up correctly.)
  10. Within the Foreach Loop container, add an Execute SQL task that updates the necessary records to show that they have been processed.

I realize that I've not addressed every one of your requirements, but hopefully this will give you a good starting point to solve your problem.

Also, since you are new to SSIS and since this is not a trivial exercise, it would be a great idea for you to create a few sample/starter packages that use the different techniques described above in a simpler package. If you try to bite off this whole thing all at once, it's probably going to be an exercise in frustration.

Enjoy!

P.S. Please reply only to these forums, not via email, so that the entire community can benefit from the issues raised on the forums.






Re: Please help me SSIS...

dev15`4534345677

Hi mathew,

Thank you very much for the reply. This helps me to start confidently. If i have any questions i will post back ito this same forum.

Thanx once again..

rgds,

dev






Re: Please help me SSIS...

dev15`4534345677

Hi,

Could you pls explain in detail the steps 6 and 7 as i am facing difficulty to create the loop and assign the variable values,

Regards,

Dev






Re: Please help me SSIS...

MatthewRoche

This should get you back on track:

http://www.sqljunkies.com/WebLog/knight_reign/archive/2005/03/25/9588.aspx






Re: Please help me SSIS...

dev15`4534345677

Hi Mathew,

Thanx for directing me ....

Regards,

Dev.






Re: Please help me SSIS...

dev15`4534345677

Hi Mathew,

Hope you are doing good.

I am struck at one point. I am trying to this operation and not able to go further.

1. I have got the dataset to a variable in the control flow.

2. I am looping through the dataset based on a coloumn.

3. Now inside my For each loop i have a dataflow task.

4. In the data flow task i am trying to build a dynamic query using the OLEDB Source and i have selected SQL Command from variable. And the variable build the Query as select * from @othervariable.

Now my question is

Can i send the data of each of the Query resultset to an out put text file using Flat File Connection If yes pls guide me how I have tried to create a flat file connection but i am failing how to map the data comming from step 4 dynamically for every query, since every query gives you a different resultset with different coloumns.

Thanks in advance..

Regards,

Dev.