Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2009
    Posts
    79

    Unanswered: Import text files into SQL server 2005 database tables

    Hi All,

    I have some text files with delimiter "" which is a rarely used delimiter now I want a query which will import the text data files data into my existing sql server database table .i.e. mydata. I have following query which I got from google search but it's not working can any one please help me with the same.


    Code:
    Use Data_Meta
    
    
    BULK INSERT dbo.abc
        FROM 'c:\mydata.txt' 
        WITH 
        ( 
            FIELDTERMINATOR = '', 
            ROWTERMINATOR = '\n' 
        )
    Please help...

    Thanks a lot for your help in advance.

  2. #2
    Join Date
    Sep 2009
    Posts
    79

    Import text files into SQL server 2005 database tables

    Hi All,

    Did any one get the chance to look into the above post. Please help....

    Thanks a lot for your help in advance.

  3. #3
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    What error are you getting?
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  4. #4
    Join Date
    Jan 2009
    Location
    United Kingdom
    Posts
    77
    The query looks good - as an initial comment , if you could follow up with the error response, then we can troubleshoot.

  5. #5
    Join Date
    Sep 2009
    Posts
    79

    Import text files into SQL server 2005 database tables

    Hi All,

    Thanks is the error message which I encounter when I try to run the query which I have put in my initial post.

    Error Encountered :
    Code:
    Msg 4866, Level 16, State 1, Line 4
    The bulk load failed. The column is too long in the data file for row 1, column 1. Verify that the field terminator and row terminator are specified correctly.
    Msg 7399, Level 16, State 1, Line 4
    The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
    Msg 7330, Level 16, State 2, Line 4
    Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
    Thanks a lot for your help in advance.

  6. #6
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    well, how about you create a small file, modify some values, and try to use it as a source for bulk load? And if it fails again with the same error, - post both the file and the format file here.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •