Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How To fetch records from xlsheet

How To fetch records from xlsheet

Scheduled Pinned Locked Moved Database
databasesysadmintutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    raghvendrapanda
    wrote on last edited by
    #1

    hy, I want to fetch records from xlsheet...i used the following query in my local server DECLARE @SQLconnect VARCHAR(8000), @FileName varchar(256) SET @FileName='C:\CopyofOTFormat.xls' SET @SQLconnect = 'SELECT * INTO ##tmpOrders FROM OPENROWSET(''Microsoft.Jet.OLEDB.4.0'', ''Excel 8.0;Database=' + @FileName + ''', ''SELECT * FROM [Sheet1$] '')' PRINT @SQLconnect -- SELECT * INTO ##tmpOrders FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=F:\data\export\excel\Top10.xls', 'SELECT * FROM [Sheet1$]') EXEC (@SQLconnect) SELECT * FROM ##tmpOrders SELECT COUNT(*) FROM ##tmpOrders -- 2452 DROP TABLE ##tmpOrders It works in my local server but when i run it in the online server...it says that the xlsheet could not be found. Is there any way i can access it in online server without actually saing it over there Thanks & Ragards raghvendra panda

    L 1 Reply Last reply
    0
    • R raghvendrapanda

      hy, I want to fetch records from xlsheet...i used the following query in my local server DECLARE @SQLconnect VARCHAR(8000), @FileName varchar(256) SET @FileName='C:\CopyofOTFormat.xls' SET @SQLconnect = 'SELECT * INTO ##tmpOrders FROM OPENROWSET(''Microsoft.Jet.OLEDB.4.0'', ''Excel 8.0;Database=' + @FileName + ''', ''SELECT * FROM [Sheet1$] '')' PRINT @SQLconnect -- SELECT * INTO ##tmpOrders FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=F:\data\export\excel\Top10.xls', 'SELECT * FROM [Sheet1$]') EXEC (@SQLconnect) SELECT * FROM ##tmpOrders SELECT COUNT(*) FROM ##tmpOrders -- 2452 DROP TABLE ##tmpOrders It works in my local server but when i run it in the online server...it says that the xlsheet could not be found. Is there any way i can access it in online server without actually saing it over there Thanks & Ragards raghvendra panda

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      raghvendrapanda wrote:

      Is there any way i can access it in online server without actually saing it over there

      The online server needs access to the "F:\" drive that you're referring to in your connectionstring. That means that the Excel-sheet needs to be saved on the machine that's going to read it.

      I are Troll :suss:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups