Questions tagged [bcp]

The bulk copy program `bcp` is a command line tool that can be used to export data from Microsoft® SQL Server™ or SAP Sybase Adaptive Server Enterprise databases to a data file in a user-specified format. bcp can also be used to bulk-load (=quickly import) data into the database server. The Microsoft and Sybase versions have similar syntax, but can not be used interchangeably.

The bcp utility copies data between an instance of Microsoft® SQL Server™ 2000 and a data file in a user-specified format

1159 questions
7
votes
1 answer

I/O error while reading BCP format file

Today I created a new staging table and a BCP .fmt file. I created some test data and attempted to run the BCP utility from the command line: I've got about 20 different format files and staging tables from previous work and this is the first time…
Jon Raynor
  • 3,804
  • 6
  • 29
  • 43
7
votes
4 answers

How to import a very large csv file into an existing SQL Server table?

I have a very large csv file with ~500 columns, ~350k rows, which I am trying to import into an existing SQL Server table. I have tried BULK INSERT, I get - Query executed successfully, 0 rows affected. Interestingly, BULK INSERT worked, in a matter…
Micky W.
  • 85
  • 1
  • 1
  • 8
7
votes
2 answers

how to export sql data to csv using bcp

I use simple code declare @sql varchar(8000) select @sql = 'bcp ExcelAnalysis.dbo.ClearDB out c:\csv\comm.txt -c -t, -T -S '+ @@servername exec master..xp_cmdshell @sql but this code export all my table, but i need only some fields and…
psysky
  • 3,037
  • 5
  • 28
  • 64
7
votes
1 answer

Bulk Insert with Format File (Fixed Width) - Unexpected end of file was encountered

BULK INSERT [Alldlyinventory] FROM 'C:\Users\Admin\Documents\2NobleEstates\DATA\Download\Output\test.txt' WITH (FORMATFILE = 'C:\SQL Data\FormatFiles\test.xml'); Format file:
Ben
  • 109
  • 2
  • 8
7
votes
1 answer

Why am I getting the "Valid table name is required for in, out or format" error with BCP?

I want to import a table while keeping the identity column. In cmd, I enter: bcp database.edg.Hello in C:\Users\Tech\Downloads\p.csv -c -E -S 349024ijfpok.windows.net\MSSQLSERVER -T Which returns: A valid table name is required for in, out…
user5112255
  • 81
  • 1
  • 3
7
votes
6 answers

What is the quickest way to import 60m records into SQL

I have a 5-6 tables in my database that I need to populate with test data to test peroformance in my app. I can write a code and do a bulk insert my prediction is that it will take nearly 3 days to run so I assumed there must be a quicker way. Any…
Jon
  • 38,814
  • 81
  • 233
  • 382
7
votes
2 answers

Does bcp out maintain row order while exporting into a data file?

I need to export data to a file from a huge table with only one column but thousands of rows where the ordering of row is important. I am using bcp command as below bcp DBNAME.dbo.tblName out mydata.dat -Uusername -Ppassword -c I checked with the…
Thunderhashy
  • 5,291
  • 13
  • 43
  • 47
7
votes
5 answers

Decrease the output of bcp export

In our project we are using bcp command to export about million of rows and logging the output to an output file. For bcp import I can control the output of bcp command by using the -b switch which specifies the no. of rows to be imported in a…
Ashish Gaur
  • 2,030
  • 2
  • 18
  • 32
7
votes
3 answers

SQLState = S1000, NativeError = 0

I am getting this Error While I try to do BCP SQLState = S1000, NativeError = 0 Error = [Microsoft][SQL Server Native Client 11.0]Unable to open BCP host data-file This is my code: DECLARE @dump_data1 varchar(500) SET @dump_data1 = 'bcp "select…
user2704062
  • 81
  • 1
  • 2
  • 4
7
votes
3 answers

Boost BCP doesn't output any files?

I'm trying to use the Boost Copy (BCP) utility to pull the normal_distribution class out of Boost. However, when I do bcp normal_distribution ./my_normal_distribution_dir, nothing appears in the my_normal_distribution_dir directory. Here's some more…
solvingPuzzles
  • 8,541
  • 16
  • 69
  • 112
6
votes
2 answers

Insert rows with Unicode characters using BCP

I'm using BCP to bulk upload data from a CSV file to SQL Azure (because BULK INSERT is not supported). This command runs and uploads the rows: bcp [resource].dbo.TableName in C:\data.csv -t "," -r "0x0a" -c -U bcpuser@resource -S…
mtmacdonald
  • 14,216
  • 19
  • 63
  • 99
6
votes
4 answers

Does sybase 15 support the bcp api in java?

A long time ago I figured out that bcp is just a little C program that calls the special bit of the sybase client api to do mass data moving into the database. It lies cheats and steals and skips check constraints all in the name of speed. Great,…
stu
  • 8,461
  • 18
  • 74
  • 112
6
votes
4 answers

SQL Server execute xp_cmdshell to import text file over FTP protocol from a UNIX box

In the past I have used xp_cmdshell in SQL Server to invoke BCP utility for importing a text file into a table on SQL Server between two Windows machines. The two machines were on the same domain without needing a password (since the SQL server…
Angel Cloudwalker
  • 2,015
  • 5
  • 32
  • 54
6
votes
1 answer

character encoding issue with the BCP and ó

I have a file that needs to go to Poland. In my data I have an ó. When I output the data to a table the ó is still there as the field is NVARCHAR. When I cut and paste from the table into Excel or Notepad++ the ó stays When I use the BCP utility…
Mike
  • 5,918
  • 9
  • 57
  • 94
6
votes
2 answers

How to extract boost::filesystem using bcp

I'm trying to create a subset of the boost library including the filesystem module, so I can include that subset in my project repository. I got a linker error until I copied the .lib files over manually. I'm using Visual Studio 2013 on Windows 7…
cp.engr
  • 2,291
  • 4
  • 28
  • 42
1 2
3
77 78