Text file import to sql server

hello experts
i am looking the best practise considering performance to import a text file to a sql server 2008r2. i have 1,500 files that need to be imported to sql server? thank you as usaual.

efratb,
SSIS would be an good option:
http://www.codeproject.com/Articles/155829/SQL-Server-Integration-Services-SSIS-Part-1-Basics
http://blog.sqlauthority.com/2011/05/12/sql-server-import-csv-file-into-database-table-using-ssis/
in addition to ssis, you can also achieve the same thru bcp. check:
http://databases.about.com/od/sqlserver/a/bcp.htm
Thanks,
Jay
<If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

Similar Messages

  • Producing text file from PL/SQL procedure (UTL_FILE)?

    Hi,
    I need to produce a text file from a PL/SQL procedure. My output should be a little over 38K records and my query has 70 fields. I'd like to separate the fields by pipe delimiters in the text file. I can either concatenate all 70 fields into one variable for each record or send all 70 fields over with a pipe, whichever is easier. It looks like I can't spool within PL/SQL but UTL_FILE might be an option from what I'm reading. Does anyone have any good, simple example(s) to produce a text file using this package in calling multiple fields from a LOOP? Our os is UNIX and db is Oracle 9i.
    Also, I've read that UTL_FILE has a record output of 1,023 bytes. Is this for each record line or the whole file size? I belive the max # of characters for each line wouldn't exceed 500 characters. The 38K rows I have for the data set would be well over 1MB. If this is the case, is there a work around to produce a larger text file?
    Any suggestions and/or examples would be greatly appreciated.
    Thanks,
    Eric

    Assuming the goal is to create a text file on the database server, you can use UTL_FILE here. Each line can be 1023 characters, but you can have as many lines as you'd like.
    Tom Kyte has an example here
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:235814350980
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Creating a text file using pl/sql

    how can one create a text file using pl/sql?
    Say for example abcd.txt in the d: drive
    (d:\abcd.txt)
    on a windows nt server

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by bhrigu nagal ([email protected]):
    thanks for your replies
    I had already set the utl_file_dir parameter
    I tried the utl package and wrote the following code but got some errors
    declare
    filehandler UTL_FILE.FILE_TYPE;
    begin
    filehandler:=UTL_FILE.fopen('d:/intel/','myfile.txt','w');
    utl_file.put_line(filehandler,'look masjdfgsd\n');
    utl_file.fclose(filehandler);
    exception when utl_file.invalid_path then
    raise_application_error(-20023,'bhrigu ,chk the path');
    end;
    the errors
    ERROR at line 1:
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "SYS.UTL_FILE", line 101
    ORA-06512: at "SYS.UTL_FILE", line 157
    ORA-06512: at line 4
    if u know what this is please tell me
    thanks bhrigu
    <HR></BLOCKQUOTE>
    U need :
    1) To have UTL_FILE_DIR param in the init file of the instance with the same directory (don't forget to stop and restart the base)
    2) Handled the exceptions listed in the utl_file package (Oracle_home\rdbms\admin\utlfile.sql) in your source.
    3) Turn set serveroutput on in SQL*Plus.
    Run your procedure and see the error message to debug.
    Good luck
    null

  • Generating Text files from PL/SQL

    To generate Text files from PL/SQL on SERVER, i can use UTL_FILE
    package, but how do i create text files on client ( i.e., on the
    C: drive ) by executing anonymous PL/SQL blocks.
    Thanks in advance.

    You can use DBMS_OUTPUT to display stuff to the screen and the
    SQL*Plus SPOOL command to write screen output to a file on your
    local drive.
    magic!
    APC

  • How can I load a .xlsx File into a SQL Server Table using a Foreach Loop Container in SSIS?

    I know I've REALLY struggled with this before. I just don't understand why this has to be soooooo difficult.
    I can very easily do a straight Data Pump of a .xlsX File into a SQL Server Table using a normal Excel Connection and a normal Excel Source...simply converting Unicode to DT_STR and then using an OLE DB Destination of the SQL Server Table.
    If I want to make the SSIS Package a little more flexible by allowing multiple .xlsX spreadsheets to be pumped in by using a Foreach Loop Container, the whole SSIS Package seems to go to hell in a hand basket. I simply do the following...
    Put the Data Flow Task within the Foreach Loop Container
    Add the Variable Mapping Variable User::FilePath that I defined as a Variable and a string within the FOreach Loop Container
    I change the Excel Connection and its Expression to be ExcelFilePath ==> @[User::FilePath]
    I then try and change the Excel Source and its Data Access Mode to Table Name or view name variable and provide the Variable Name User::FilePath
    And that's when I run into trouble...
    Exception from HRESULT: 0xC02020E8
    Error at Data Flow Task [Excel Source [56]]:SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occured. Error code: 0x80004005.
    Error at Data Flow Task [Excel Source [56]]: Opening a rowset for "...(the EXACT Path and .xlsx File Name)...". Check that the object exists in the database. (And I know it's there!!!)
    I don't understand by adding a Foreach Loop Container to try and make this as efficient as possible has caused such an error unless I'm overlooking something. I have even tried delaying my validations and that doesn't seem to help.
    I have looked hard in Google and even YouTube to try and find a solution for this but for the life of me I cannot seem to find anything on pumping a .xlsX file into SQL Server using a Foreach Loop Container.
    Can ANYONE please help me out here? I'm at the end of my rope trying to get this to work. I think the last time I was in this quandry, trying to pump a .xlsX File into a SQL Server Table using a Foreach Loop Container in SSIS, I actually wrote a C# Script
    to write the contents of the .xlsX File into a .csv File and then Actually used the .csv File to pump the data into a SQL Server Table.
    Thanks for your review and am hoping and praying for a reply and solution.

    Hi ITBobbyP,
    If I understand correctly, you want to load data from multiple sheets in an .xlsx file into a SQL Server table.
    If in this scenario, please refer to the following tips:
    The Foreach Loop container should be configured as shown below:
    Enumerator: Foreach ADO.NET Schema Rowset Enumerator
    Connection String: The OLE DB Connection String for the excel file.
    Schema: Tables.
    In the Variable Mapping, map the variable to Sheet_Name, and change the Index from 0 to 2.
    The connection string for Excel Connection Manager is the original one, we needn’t make any change.
    Change Table Name or View name to the variable Sheet_Name.
    If you want to load data from multiple sheets in multiple .xlsx files into a SQL Server table, please refer to following thread:
    http://stackoverflow.com/questions/7411741/how-to-loop-through-excel-files-and-load-them-into-a-database-using-ssis-package
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Is it possible to load a dump file collected from sql server to orcle 10gR2

    Hi..
    As a part of data migration from legacy systems , we need to migrate only required tables from Sql server to Oracle 10gr2 .
    At present client is telling that he will give it as dump file.
    My question is , Is it possible to load the dump file collected from sql server to oracle 10gR2?
    Thanks in advance ..

    yes, it is.
    Using for example SQL Developer Migration Workbench even allows you to create unload scripts for the desired SQL Server tables and it also creates the DDL scripts for you to create the Oracle tables similar to the SQL Server table AND it alows creates the SQL*Loader scripts that allow you to load the SQL Server generated dump file into the Oracle db.
    Here the link:
    http://www.oracle.com/technology/tech/migration/workbench/index_sqldev_omwb.html
    If you do not want to use this utility, you can also use SQL*Loader to load the content of the SQL Server dump file into the Oracle database; but in this case you have to write the whole SQL*Loader control scripts on your own.
    Edited by: kgronau on Sep 16, 2009 1:54 PM

  • How to store a word file in MS SQL server

    Hi,
    Am new to java, I want to store a Word File into MS SQL Server, pls tell me how to do this.
    What should be Data type I should choose in the MS SQL Server.
    rgds
    Ravi Bharathi

    You will have to simply load the file as a chunk of binary data in a blob (Binary Large Object) type column.
    In MS SQL Server the blob type is known as 'Image'

  • Unable to access objects in my own schema -- imported from SQL Server

    Hi All,
    I have imported some tables from MS SQL SERVER 2005 to Oracle 9i (9.2.0.1.0) on Windows machine.
    When I fire the query like "SELECT * FROM TAB", I can see the list of all those tables that I have imported, but the problem is that if I try to fetch the data from a specific table, the error is shown as "TABLE OR VIEW DOES NOT EXISTS".
    Can you please suggest me some work around to get the data from the tables?
    Thanks in advance
    Himanshu

    Replied in your Re: Unable to access objects in my own schema -- imported from SQL Server.
    Yoann.

  • Generating text file using PL/SQL

    can any body send sample program how to generate text file using PL/SQL program.I want to store table data into that text file.

    Hi,
    try this.
    Thanks
    CREATE OR REPLACE procedure write_index (TABLE_NAME_ACCEPT VARCHAR2) IS
    id UTL_FILE.FILE_TYPE;
    name VARCHAR2(20) := 'e:\db_coca\input';      
    err VARCHAR2(100);      
    ColNameLength Integer;
    NumberoFColumns Integer;
    num NUMBER;           
    i integer;
    loc_query VARCHAR2(2000);
    cursor_name INTEGER;
    ret INTEGER;
    l_const_name VARCHAR2(30);
    CURSOR c_columns(i_Constraint_name VARCHAR2) IS
         SELECT *
         FROM     all_cons_columns
         WHERE     CONSTRAINT_NAME = i_Constraint_name
         order by table_name;
    BEGIN
    DBMS_OUTPUT.PUT_LINE('BEFORe OPEN');
    --id := UTL_FILE.FOPEN('e:\db_coca\input',name,'w');          
         --IF UTL_FILE.IS_OPEN(id) THEN
         --     DBMS_OUTPUT.PUT_LINE('Opened');
         --ELSE
         --     DBMS_OUTPUT.PUT_LINE('Still Closed');           
         --END IF;          
    DBMS_OUTPUT.PUT_LINE('AFTER OPEN');
    --The table generation script
         loc_query := 'Select CONSTRAINT_NAME from user_constraints ';
         loc_query := loc_query || ' where owner = ' || '''CPS''';
         loc_query := loc_query || ' AND CONSTRAINT_TYPE = ' || '''P''';
         dbms_output.put_line('TABLE_NAME_ACCEPT = ' || TABLE_NAME_ACCEPT);
         IF NOT (TABLE_NAME_ACCEPT IS NULL ) THEN
              loc_query := loc_query || ' AND TABLE_NAME like ''';
              loc_query := loc_query || TABLE_NAME_ACCEPT ;
              loc_query := loc_query || '''';
         END IF;
         cursor_name := DBMS_SQL.OPEN_CURSOR;
    dbms_output.put_line('Query = ' || loc_query);
         DBMS_SQL.PARSE(cursor_name, loc_query, DBMS_SQL.v7);
    dbms_output.put_line('After parse');
         dbms_sql.DEFINE_COLUMN(cursor_name, 1,l_const_name, 30);
         ret := DBMS_SQL.EXECUTE(cursor_name);
    --     IF ret > 0 THEN
         LOOP
         dbms_output.put_line('return = ' || ret);
              IF DBMS_SQL.FETCH_ROWS(cursor_name) > 0 THEN
                   dbms_sql.COLUMN_VALUE(cursor_name, 1,l_const_name);
              --     dbms_sql.BIND_VARIABLE(cursor_name,
    l_const_name,CONSTRAINT_NAME);
              --     FOR C10 in Table_Loop Loop          --The cursor
    for the table name
                   Select COunt(*) INTO NumberoFColumns from
                   all_cons_columns
                   Where CONSTRAINT_NAME = l_const_name;
         --          FOR C11 IN c_columns(l_const_name) LOOP
         --          End loop;
         --          UTL_FILE.PUT(id, ');');
              ELSE EXIT;
              END if;     --THe 1 st cursor if is closed
         End Loop;     --The table loop ends here
              DBMS_SQL.CLOSE_CURSOR(cursor_name);
    --     END IF;     
    --     UTL_FILE.PUT_LINE(id,name);
    --     UTL_FILE.PUT(id,'It worked and wrote to this file');
         UTL_FILE.FCLOSE(id);
         DBMS_OUTPUT.PUT_LINE('Successful write to file');          
    EXCEPTION     
    WHEN OTHERS THEN               
         err := SQLERRM;          
         num := SQLCODE;
         DBMS_OUTPUT.PUT_LINE(err);          
         DBMS_OUTPUT.PUT_LINE(num);
         DBMS_OUTPUT.PUT_LINE('Error in writing to file');     
    END write_index;

  • Ssis - import data from flat file to table (sql server 2012)

    i have create a ssis for importing data from flat file to table in sql server 2012.
    but i got the below error for some column in data flow task.
    error: cannot processed because than one code page (950 and 1252)
    anyone helps~

    Hi,
    The issue occurs because the source flat file uses ANSI/OEM – Tranditional Chinese Big5 encoding. When processing the source file, the flat file connection manager uses code page 950 for the columns. Because SQL Server uses code page to perform conversions
    between non-Unicode data and Unicode data, the data in the code page 950 based input columns cannot be loaded to code page 1252 based destination columns. To resolve the issue, you need to load the data into a SQL Server destination table that includes Unicode
    columns (nchar or nvarchar), and convert the input columns to Unicode columns via Data Conversion or the Advanced Editor for the Flat File Source at the same time.
    Another option that may not be that practical is to create a new database based on the Chinese_Taiwan_Stroke_BIN collation, and load the data to non-Unicode columns directly.
    Reference:
    http://social.technet.microsoft.com/Forums/windows/en-US/f939e3ba-a47e-43b9-88c3-c94bdfb7da58/forum-faq-how-to-fix-the-error-the-column-xx-cannot-be-processed-because-more-than-one-code-page?forum=sqlintegrationservices 
    Regards,
    Mike Yin
    TechNet Community Support

  • Importing an SQL Server TEXT data type field in Oracle - problem with LONG

    Hello,
    I work in Oracle 9i and I created a view on a distant SQL Server database that contains a TEXT data type field. But I have a problem when I select that field in Oracle; I have the following error message: "ORA-00997: forbidden use of LONG data type".
    Could anybody have a solution for me, to solve that problem?
    Thanks a lot!

    It is very difficult to suggest anything without seeing your code.  I don't even know if what you are seeing is the actual value or an error code.  Often, negative numbers are indicative of error codes. 
    For instance -1 could mean that you have an invalid reference or path, etc...
    Can you post your code?

  • How to read a text file through pl/sql

    How to read a text file through pl/sql

    pl/sql runs inside the database. so your file also should be on the database server file system for you to be able to read.
    check out UTL_FILE package. This is the database package to read/write files on the database server.

  • Text file imported into Hyperion report BQY

    Hi,
    I would like to know the internal process how Hyperion works in the scenario
    1. The Hyperion report query in select * from emp
    2. A text file containing list of emp ids has been imported into the report bqy
    I believe the query which gets fired on the underlying database is still select * from emp. If so, is it true that the result set of the "select * from emp" then is filtered in the Hyperion server memory based on the emp ids listed in the text file which is embedded in teh report bqy?
    I am using Hyperion 9.3.0.
    Any input would be appreciated.
    Regards,
    Suresh

    Try using the package UTL_FILE.
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_file.htm#998101

  • How to import  from sql server to oracle 10g

    Hi,
    I have given some file with no extention and the client told me that
    it has two tables in it emp and dept. which he extracted from sql server.
    Now I have the file with me.
    I have a local oracle database .
    Is it poosible to load that file into the oracle 10g database.
    If possible please send me the details. If not please tell me the details reqd to do the things.
    Thanks in Advance

    Well, what format is the file in? If it is a text file you should be able to use SQL*Loader.
    Can you view the file using (for example) Wordpad?
    Or from the command line (ie in a DOS box) just say
    TYPE myfileThen post the format for a few lines here, between and (use square brackets instead of curly)
    Regards Nigel

  • Stored procedure to Insert any type of file in to sql server from the path ?

    Hi,
    I have a table "FileMGT" and storing files in to disks. 
    FileMGT Columns :
    FileName
    FilePath
     020324.doc
    f:\cfs\Claims Document
     5013.tif
    f:\Addendums
     2790.msg
    t:\Treatycfs
    Now I would like to store all files from above table in to sql sever by adding content column ( VARBINARY ) datatype.
    Please help me do solve this.
    Thank you.

    Why do you want to store files in SQL Server? If your version is SQL Server 2012, then you can try with FILETable.
    Please refer the below link for the same
    http://technet.microsoft.com/en-us/library/ff929144.aspx
    The FileTable feature brings support for the Windows file namespace and compatibility with Windows applications to the
    file data stored in SQL Server. FileTable lets an application integrate its storage and data management components, and provides integrated SQL Server services -
    including full-text search and semantic search - over unstructured data and metadata.

Maybe you are looking for

  • I've got to many advertisements in a new tab in safari, how to get rid of it?

    Hello everyone, I'm using Apple for 3 years now and I'm really satisfied with it. But lately when I go on safari and I want to use a website, advertisements keep popping up in new tabs. The advertisements are from mackeeper, movie sites and advertise

  • Transparency and flattening

    I'm using AI CS3 on PC. I've been given an EPS file that was apparently created in AI 11 on Mac. It has no preview (at least not that will show up on PC). I opened the file in AI to save it with a preview. When I do a Save As, AI says: "When spot col

  • Range of Object Worksheet Failed error when creating variable report

    I have BO Planning version 11.6 and am running it in conjunction with Excel 2007. Every time I try to use the Report Wizard I can create a report the first time with no problems. However, when I exit out of that report and then try to create a new re

  • Encoding and other daemons

    hello folks, I need some advice. I need an application(s) to make, VCD, DVD, encode videos to divx/xvid, what recommendations I have?

  • Premiere Elements 4 Crashes in Vista

    Trying to start a project ... I haven't even gotten all of my video clips put down yet and the application randomly crashes!! Totally frustrating. I'm looking for any guidance whatsoever ..... Adobe Support only takes calls M-F 9-5 .... conflicts wit