Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2008
    Location
    Russia! Kazan!
    Posts
    5

    Unanswered: how 2 import data from excel to ms sql server?

    The query is:
    SELECT * FROM
    OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;IMEX=1;Database=C:\Daedalus\1.xls;',sheet1$)
    Nothing before or after
    And output is:
    OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error. The provider did not give any information about the error.
    OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBInitialize::Initialize returned 0x80004005: The provider did not give any information about the error.].
    I'm using mssql serv 2000 sp4 under msde 2000
    Help appreciated much

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    is the file 1.xls there?
    does someone have it open?
    does it have a Sheet1?
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    is this C:\Daedalus\1.xls;',sheet1$ location relative to the sql server or where the query is coming from?
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by Thrasymachus
    is the file 1.xls there?
    On the servers C:\Daedalus\ ?
    George
    Home | Blog

  5. #5
    Join Date
    Oct 2006
    Location
    CA
    Posts
    210
    Is it open (locked) by Excel?

  6. #6
    Join Date
    Oct 2008
    Location
    Russia! Kazan!
    Posts
    5
    First - thanks for reply, and keep in mind that i'm a newby in mssql (relative location? 8) )
    Second - 1.xls is on its place in C:\Daedalus on a local machine, not on a server
    (exec master..xp_cmdshell 'dir C:\Daedalus\1.xls' gives NULL),it's not open by anyone/anything,
    and it has sheet1...
    This error is thrown even if spreadsheet with 4 values is used
    Last edited by Daeda1us; 10-28-08 at 07:53.

  7. #7
    Join Date
    Oct 2008
    Location
    Russia! Kazan!
    Posts
    5
    And one more thing - can we turn on logging every event in profiler?
    When I import the data by DTS it also gives mistake saying "Too much rows...", THIS can be solved by selecting only the rows needed 2 import in wizard,but while importing I turn on the profiler and log every event, after import done tryin' to execute the profiler's query- it creates a new table, but it's empty?!?

  8. #8
    Join Date
    Oct 2008
    Location
    Russia! Kazan!
    Posts
    5
    Query
    SELECT * INTO XLImport3 FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
    'Data Source=C:\Daedalus\2.xls;Extended Properties=Excel 8.0')...[Sheet1$]
    gives the same error

  9. #9
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    that's because when you refer to a path in a sql server query it assumes you are refering to the location relative to the server. You might be able to fix this using the UNC path (\\machinename\youlocation\1.xls) and opening a share that the sql server account has access to or by moving the file to the server.

    "too much rows". Something tells me that is not the exact error message. can you tell us the exact error.

    btw, never log ever event in profiler for a production server. you are going to hose the server.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  10. #10
    Join Date
    Oct 2008
    Location
    Russia! Kazan!
    Posts
    5
    Thrasymachus, thanks!!!
    That relative location stuff really worked!
    "Too much rows" - the real text is in russian Anyways as I mentioned, this problem is solved by selecting only the rows needed in table creation wizard(DTS)
    Thanks for profiler advise too!!
    Last edited by Daeda1us; 10-28-08 at 10:08.

Posting Permissions

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