Solved

BCP and bulk insert questions

Posted on 2013-11-18
4
375 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

635 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