Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Excel File Upload into SQL Server

Author  Topic 

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2011-09-13 : 09:16:56
Hi All..
I wanted to upload a EXCEL file from my local PC to remote location. But i am getting error. I think i am getting error because the file to be upload is present on my local system and i am trying to do it on remote server.
So is there any way in which i can import my local system file into remote SQL Server. I used that query to upload file.

SELECT * INTO TestLoad FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=C:\test\testLoad.xls;Extended Properties=Excel 8.0')...[Sheet1$]

WHERE "C:\test\testLoad.xls;" is path on my local PC..

iF theRe iS a wAy iN tHen theRe iS a wAy oUt..

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-13 : 10:33:55
you need to put it in a shared path in your pc and then use path in UNC format like \\yourmachine\... and also make sure your machine is accessible from server by using the account you're using to execute the script

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2011-09-14 : 01:28:11
IS this possible that i upload file simple to server and than use server path only. So if this will work.

iF theRe iS a wAy iN tHen theRe iS a wAy oUt..
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-14 : 03:35:59
yep. for that you need to manually copy file to path in actual server

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2011-09-14 : 07:23:49
Yes thanks Vishak.. front end will do this for me.

iF theRe iS a wAy iN tHen theRe iS a wAy oUt..
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-14 : 08:35:26
welcome


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -