Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004
    Posts
    95

    Unanswered: OPENROWSET only returns first row

    Hello,

    I've got some text files that I need to read and make some calculations, before inserting data into a table.

    When I use:
    Code:
    select BulkColumn as txt from openrowset(BULK 'c:\Temp\data\035.txt', SINGLE_NCLOB) as text
    it only retrieves the first row. How can I select all the lines in the file?

    Thanks.

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Using "SINGLE_NCLOB" will return the contents of the file as a single row:
    Quote Originally Posted by BOL
    SINGLE_NCLOB

    By reading data_file as UNICODE, returns the contents as a single-row, single-column rowset of type nvarchar(max), using the collation of the current database.
    If you want to return the file as multiple rows, you may need to look into a format file, where you define a row terminator.

Posting Permissions

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