OPENROWSET mangles the datarecord on import any suggestions help please

  • Hello,

    I have a text file that I need to import into SQL 2010 database.

    I am automating the task via stored proc but having an issue with OPENROWSET query.

    everything works but it mangles the first data record.

    my folder structure is simple

    I have a "D:\" drive on SQL server where a "DataImport" folder located as in script

    when script is run the first DATA row "style = .0690/6MM "

    is bad. everything else is a OK.

    what am I missing here?

    thanks ....

    archive attached includes files as follows:

    SelectStmt.sql -- actual SQL stmt

    testData.fmt -- Format File for OPENROWSET

    testData.txt -- DATA

  • Many who can answer your question do not like opening attachments to be sure that a bug or malicious code is not included. To help you get an answer, please post in the open forum you T-SQL, sample data, etc., etc.

    To learn how to do so quickly and easily please click on the first link in my signature block. The article contains instructions and the T-SQL to make it an easy job for yourself.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • thanks bucket,

    happy to report that I solved this my self.

    it was a datafile issue, first row were missing a column.

    as for attachment... well next time I will post everything in the post itself thank you.

    I though I was being considered in making my post readable

    also I was afraid that if it is something in the datafile then it will be lost if I copy/paste raw data.

  • Thank you for replying ... Remember when posting detail you do NOT want to post data that is confidential, so if that is the case you may have to do some alteration of the sample data to hide the confidential aspects or elements.

    But glad that you found a solution to your problem.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply