Import from Excel (insert into ---- select from Openrowset : not in the same order as in Excel Why? How to avoid this

  • Hello,

    I have to import data from Excel from TSql stored proc.

    The import is going well but the order of rows are not the same as in Excel .

    This is mandatory for the process...

    1. How to avoid this ?

    2. if not possible, how to retrieve rownumber from the Excel sheet and insert it in the table?

    Many tks.

  • you have an alternate of linked server to excel.

    Follow this on how to create LS for excel.

    http://support.microsoft.com/kb/306397

    ----------
    Ashish

  • Tks for this.

    However problem with linked server is that I do not know how many files I have to import... This depends from day to day.... As far as I have understood Linked server you have to mention the name if the file.... (which is unknown also) ....

  • yes correct but if that is not so frequent activity then you can rename old file which you already inserted and then new file should be named exactly as we configure in linked server and must be in same location.

    ----------
    Ashish

  • hum .... it's a daily activity ...

    However, I have found a way to create linkedserver with sp so I'm currently trying to test this in a loop....

    Hope this will solve my problem.

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

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