SSIS to Export data from SQL to flat file dynamically

Hi.
I hope somebody can help me out, I have a table like this:
Date, StoreNumber, ProductCode, SalesItem, SalesAmout, Inventory
09-10-2014,10,1,10,10,30
As you can see I have a Date field and my table has information from 2014 at daily basis, What I'm trying to do is to export the information of this table to flat files, creating one file pear each date, as a result I will have about 280 files (one per date)
I do not know if it is possible or not.
Thank you.

Hi Mike,
you can do it using one Execute SQL Task and a ForEach Loop variable driven.
1st the Execute SQL Task "figures out" how many iterations the loop would need. The SQL as follows would drive it:
SELECT DISTINCT [DATE] FROM MyTable;
and you get the dates placed into a package variable of type recordset for the [280] files.
And then you can operate on the recordset in the loop "shredding it" in a DFT with a source query dynamically driven by the date as "select a,b,c from mytable where date = '" + @[User::CurentDate] + "'" placing each
"date" into its own file even naming the file after the date using the current value of the package variable (ADO row concept).
See an example: http://www.sqlis.com/sqlis/post/Shredding-a-Recordset.aspx
Arthur My Blog

Similar Messages

  • How to export data from DB to flat file with ODI?

    we want to export DB2 tables to flat files.
    Who can tell me how to do it with ODI?
    Please give me a simple example or steps.
    Thank you.

    There are two ways
    Either use IKM Sql to File Append
    (or)
    OdiSqlUnload
    For OdiSqlUnload you can use this technique to provide the connection parameters - http://odiexperts.com/?p=1985

  • Error while exporting data from sql server to excel

    Hi,
    I am trying to export data from sql server to excel.
    The query that I used is s follows
    INSERT INTO OPENROWSET( 'Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Folder1\abc.xls','select * from [Sheet1$A1:IV65000]')
    select 
    column1,column2.... from Table1
    I get the following error message while doing so..
    String or binary data would be truncated.
    The statement has been terminated.
    One of the column's holds data more than 225 characters.
    What is the way to correct this, i want the whole data of the colum in the excel sheet.

    I haven't had great luck with the INSERT INTO OPENROWSET method.  Can you try one of the many samples from one of these 3 links?
    http://www.excel-sql-server.com/excel-sql-server-import-export-using-vba.htm#Excel%20Data%20Export%20to%20SQL%20Server%20Test%20Code 
    http://www.mssqltips.com/sqlservertip/1540/insert-update-or-delete-data-in-sql-server-from-excel/
    https://www.simple-talk.com/sql/database-administration/getting-data-between-excel-and-sql-server-using-odbc--/
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • How to extract data from Essbase to Flat File using ODI

    Hi,
    Anyone know how to extract data from Essbase to Flat File using ODI?
    Thanks in advance.
    Regards,
    Sumardi

    Hi,
    Have you read through :-
    Oracle Data Integrator Adapter for Hyperion Essbase Getting Started - http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/odiess_getting_started.pdf
    Oracle Data Integrator Adapter for Hyperion Essbase User's Guide - http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/odiess_users.pdf
    If you have read them and are still have a problem at what stage are you having the issues?
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Exporting data from SQL Server database to Oracle database

    Hello All,
    We need to replicate a table's data of SQL Server database to Oracle database.
    Can this task be accomplished using Import/Export wizard or Linked servers?
    Can help me regarding which Oracle data access components should i download to do this?
    I am using SQL Server 2012.
    And i have Oracle 11g release 2 client installed in my system.
    Thanks in Advance.
    Thanks and Regards, Readers please vote for my posts if the questions i asked are helpful.

    Yes you can definitely transfer data from SQL server to Oracle Have a look at below links
    Export SQL server data to Oracle Using SSIS
    Use OLEDB data provider to transfer data from SQL server to Oracle
    Using Import Export Wizard
    Similar thread
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
    My TechNet Wiki Articles

  • Issue to export data from sql to excel

    I have MS SQL 2008 Developer version and visual studio 2008. I'm using SSIS Import and Export Wizard on the VS2008 to create a simple package to export data from a table using a sql query to excel file (.xlsx), but I got the following
    error messages:
    [Destination - Query [37]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E21.
    [Destination - Query [37]] Error: Cannot create an OLE DB accessor. Verify that the column metadata is valid.
    [SSIS.Pipeline] Error: component "Destination - Query" (37) failed the pre-execute phase and returned error code 0xC0202025.
    The SQL query is
    SELECT [BusinessEntityID]
          ,[PersonType]
          ,[NameStyle]
          ,[Title]
          ,[FirstName]
          ,[MiddleName]
          ,[LastName]
      FROM [AdventureWorks2008].[Person].[Person]
    Any help will be appreciated. Thanks.
    A Fan of SSIS, SSRS and SSAS

    Or another way is to save the package created by Export Import wizard, open it in BIDS and add a Derived column task before the Excel destination to do explicit casting of the columns to your required unicode datatypes.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Procedure/batch file to export data from sql to excel(predefined path)

    Hi,
    I have countries, sites, states tables (total 3) in database (i have user id and password to connect to this database).
    every week i need to extract data from these tables into excel files and i need to save those in shared drive for team use.
    Currently i am connecting to database every time running sql query and manually exporting that latest data to excel and saving that as excel files in (G:\team\common\) folder with specific name.
    output format should be : excel (.xls)
    file names should - countries.xls,sites.xls,states.xls
    server name : ap21
    output location : G:\team\common\ ( G is shared drive).
    i heard that we could create batch file to do this task and also we could use oracle procedure to do this task. but not sure which one is the best option.
    could you please guide me what is the option and also help me with technical stuff to do this task.

    Hello,
    output format should be : excel (.xls)Do you really want to create .xls files? This is not easy to do because it is a proprietary (MS) binary format. You should consider other formats like .csv or .xlsx. Follow the link in the previous answer how to generate them.
    file names should ...The name of the files does not matter, you are free to name them as you like.
    server name : ap21
    output location : G:\team\common\ ( G is shared drive).You can write the file generated in the database only to directories that are accessible from the db as Oracle Directories. You could mount the shared drive to the db server, but it might be better to write the output to a server directory and then transfer them to the shared drive with OS-copy command or FTP.
    i heard that we could create batch file to do this task and also we could use oracle procedure to do this task. but not sure which one is the best option.I would use Oracle Scheduler to execute a PL/SQL procedure to generate the files and then a OS-batch file to transfer them. You can use the Scheduler to execute the batch file too, see {message:id=3895983}.
    Regards
    Marcus

  • Error Loading data from oracle to flat file in oracle data integrator

    Hi All,
    I m trying to load data from oracle database to flat file.But I am getting the error at step "Insert new row"(integration)
    Error Message is:
    7000 : null : com.sunopsis.jdbc.driver.file.b.i
    com.sunopsis.jdbc.driver.file.b.i
         at com.sunopsis.jdbc.driver.file.b.d.setDate(d.java)
         at com.sunopsis.sql.SnpsQuery.updateExecStatement(SnpsQuery.java)
         at com.sunopsis.sql.SnpsQuery.addBatch(SnpsQuery.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)
    I m nt able to find out the exact reason.Can anyone help me in that.

    yes...I got the mistake which i was doing.Actually the target file data type should be string and I was defined it diffrent for each column.
    When I chnged the data type to string,data get loaded to target table.
    Thanks for your reply.

  • ESB not moving data from database to flat file

    Using ESB, created an database adapter/routing service (polling for changed records) & file adapter to write all records from a database table to a flat file as a series of XML entries in the file. I only get the last record from the database into the flat file. Using JDev 10.1.3.2 and SOA Suite 10.1.3. Have a 'status' column in the source database table that is set to 'PROCESSED' when the record has been processed. After I get the one XML element, representing the last record in the database, I look at the database table and ALL rows have their 'status' column set to PROCESSED - the field was null before the database table was processed.
    How do I get ALL of the records into the flat file?
    Thanks - Casey

    Hi.
    Check this:
    ESB File Adapter: Append to log file not supported???
    Denis

  • Reg : export data from ALV to excel file

    Hi All,
    I am using REUSE_ALV_GRID_DISPLAY to display the output. I have total 73 columns getting displayed in output but when i export the data to the excel file using (ctrlshiftF9) I am getting only first 43 columns in the first row and from 44th column on wards the data is populated in the 1st  column of second row.
    Please let me know is there any particular setting by which I can get all the 73 columns in a single row.
    Thanks in advance.
    VIJAY

    Hi vijay,
    You can try setting your line width to 255 in your abap program.
    Otherwise,  you can try an alternative:
    1. Put a customize button on the ALV toolbar.
    2. Go to se41 to create th buttons
    2. do i_callback_program in ALV function. or SET PF_STATUS
    3. Then in sy-ucomm, use 'GUI_DOWNLOAD' to xls.
    Hope this helps you.
    Thanks
    William Wilstroth
    Edited by: william wilstroth on Dec 18, 2007 5:06 PM

  • How can I migrate data from SQL Server 6,5 to Oracle 8?

    We have a web site based on Microsoft SQL Server 6.5.Now we plan
    to migrate the database to Oracle 8.
    We have redesigned the tables structure and created tables under
    Oracle 8, so we only need to migrate data from SQL Server.
    We've exported data from SQL Server to text files.
    How can we import data from files and restore to Oracle tables.
    Is there a solution which let us to import data for particular
    table columns,not all columns?
    We'll be appreciated if somene can give suggestions.
    Regards
    Michael
    null

    Thank you for your reply.
    I'll try the Oracle sqlloader utility first.
    Regards
    Micahel
    Oracle Migration Workbench Team wrote:
    : Michael,
    : Oracle sqlloader is user for this sort of operation, see
    : Oracle8i Utilities
    : Release 8.1.5
    : A67792-01
    : available online through Oracle Technology Network.
    : The Oracle Migration Workbench can be used to create bcp and
    : sqlloader scripts, though since you have altered the schema
    these
    : scripts would need to be altered by hand after generation.
    : Some thought has been put into redesigning table structures in
    : the Oracle Migration Workbench, but currently it looks like
    this
    : reengineering will be left to be done by other tools, eg
    Oracle
    : Designer, once the SQLServer database has been duplicated with
    as
    : little change as possible onto Oracle.
    : Hope that helps,
    : Turloch
    : Oracle Migration Workbench Team
    : Michael (guest) wrote:
    : : We have a web site based on Microsoft SQL Server 6.5.Now we
    : plan
    : : to migrate the database to Oracle 8.
    : : We have redesigned the tables structure and created tables
    : under
    : : Oracle 8, so we only need to migrate data from SQL Server.
    : : We've exported data from SQL Server to text files.
    : : How can we import data from files and restore to Oracle
    tables.
    : : Is there a solution which let us to import data for
    particular
    : : table columns,not all columns?
    : : We'll be appreciated if somene can give suggestions.
    : : Regards
    : : Michael
    : Oracle Technology Network
    : http://technet.oracle.com
    null

  • Download data from db to CSV file and need to handle chinese character

    Hi , all , I need to write to alow to export data from db to csv file, now the problem is some column is chinese character, in both db and web page it can dispaly the chinese, but in Csv I can't display chinese character, what should I do?
    Thnak you

    HJava wrote:
    I already have res.setCharacterEncoding("UTF-8"); in my servlet, and db
    req.setCharacterEncoding("UTF-8");
    Are you sure that you have set it on the response? You do not need to set it on the request. Have you read the article? Do you understand the world of characters? It look like you still don't understand it.
    by the way, since csv is text file , how can I bold my University number??? in sb = new StringBuffer();
    sb.append("University Number");Not possible with CSV since it is text/plain. Use real XLS if you want to add formatting to cells.

  • Using SQL Server 2012 SSIS to Extract Data From SAP

    Hi
    What is the current best practice for using SQL Server 2012 SSIS to extract data from SAP R3? Please note we are looking for a solution that does not use SAP BW or SAP OHS.
    Ideally we would like to build our ETL SSIS process to make a .NET call to an SAP RFC procedure and avoid using web services.
    With SS2012 can we use any of these without using SAP BW:
    - SAP .NET Connector
    - MS ADO .NET
    - BizTalk .NET 3.0 Adapter
    Thanks and take care,
    Shayne

    Hi Shayne,
    You can use the .NET Framework Data Provider for mySAP Business Suite along with SQL Server Integration Service (SSIS) to import data from an SAP system into SQL Server database tables, flat files, or other compatible destination types. You can create an SSIS
    package that can be executed to import data from an SAP system.
    You must use the SQL Server Import and Export wizard to import data into the SQL Server database. You must provide a select query to specify data to be imported. The query must confirm to the semantics supported by the Data Provider for SAP. You can start the
    SQL Server Import Export Wizard either from the SQL Server Management Studio or from an Integration Service project in Visual Studio. Detail steps please see:
    Importing SAP Data Using SQL Server Management Studio:
    http://msdn.microsoft.com/en-us/library/cc185161(v=bts.10).aspx
    Importing SAP Data Using Visual Studio:
    http://msdn.microsoft.com/en-us/library/cc185254(v=bts.10).aspx
    Please feel free to ask if you have any question.
    Thanks,
    Eileen
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.

  • How to Export data from a Table to Excel using PL/SQL Code

    Hi,
    I need to export data from a table to the excel sheet using PL/SQL script.
    could you pls provide with custom codes or sample procedures.
    Bobby

    http://asktom.oracle.com/pls/ask/f?p=4950:8:7947129213057862756::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:728625409049

  • Import/export data from ms sql 7 to xml file in a particular xpdl format

    I'm trying to write java program to import/export data from ms sql 7 to xml file in a particular xpdl format. Can anyone suggest how to do it?

    take a glance at what these guys do: http://www.openbusinessengine.org/docs/guide.html

Maybe you are looking for

  • F110 - Payment Run OLD LOG

    Hello everyone! At my system, certain Payment Proposal canceled when the user tried to Create the payment execution. But later, this user could execute this payment successfully. At the log, there are just the messages of the latest run. Can i get at

  • Why is my screen flashing

    The screen on my imac is flashing to "blue" every few seconds. Is this a video or processor problem?

  • Budget problem for External processign Service

    Please note that , we have created a network for supply of Services from Vendor A and placed the PO for Rs.1,00,000/- Vendor has done the 45 % work and subsequently service entry sheets are posted for the same. But then Vendor expressed his inability

  • Forms6i different Object Height  at run time

    Hi, I have a multiple detail block ( No. of record displayed 10 ) ,all i need to do is change the height of the item according to the length of the text stored in it. (set_item_instance_property) not working Edited by: 936956 on May 27, 2012 2:09 AM

  • N95 maps problem can anyone help.

    Hi I've got the n95 and have been trying for about two weeks to get the sat nav thingy working .. maybe i'm not doing something right but when pressing for maps it gives me bluetooth options for connection, eg headset, and close by bluetooth phones.