Solved

BCP and bulk insert questions

Posted on 2013-11-18
4
363 Views
Last Modified: 2013-11-25
I have a user who wants to bcp or bulk insert files from his local drive or from the share drive.

My expectation is that BCP can be done from his local command line, but we're having issue getting the syntax correct.

bcp inventory.dbo.fruits in "C:\fruit\inventory.txt" –Sservername -c -T

The other option we've considered is a bulk insert so he could call it from his SQL. Is there a way to refer to the Users C drive from within the SQL? We get error code 53 when we try to run it against the share drive.

What is the best approach?

Thanks
0
Comment
Question by:BillTr
4 Comments
 
LVL 12

Expert Comment

by:Tony303
ID: 39658297
How about using a UNC path?

Are the rights OK for the folder containg the Inventory.txt file?
0
 
LVL 1

Accepted Solution

by:
BradySQL earned 150 total points
ID: 39658409
You have to use a location that the SQL and the user that it is running as has access to. This means that only location local to SQL will be available if you are using a drive path like c:\ or E:\ otherwise you will have to give it the full share path to the file you wish to import, and make sure that the user that the SQL service is running as has access to it.

\\server\path\filename.txt
0
 

Author Comment

by:BillTr
ID: 39659259
If I reference drive c:\ from within SQL am I getting my local c drive? I thought that might be a c drive on the server...which I don't have access to.
0
 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 150 total points
ID: 39660058
>> If I reference drive c:\ from within SQL am I getting my local c drive? <<

No, you're getting the drive that the SQL installation sees as the C: drive.


You either have to map your local drive with a drive letter to SQL, and give the proper permissions to access it to the necessary login(s), or create a share and grant the necessary permissions to the share.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question