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
-1
votes
1 answer

BCP pausing during upload - continues after ctrl-C

I've been uploading to a TSQL server with BCP and the upload intermittently stops. When I know it has stopped I can press ctrl-C and it will carry on instead of cancelling the upload. This doesn't lose any data, the correct number of rows will be…
TLOwater
  • 638
  • 3
  • 13
-1
votes
2 answers

batch file bcp command

Stuck with a simple batch file that runs a bcp command. I need this batch file to loop thru a txt file that contains the tables names. Here is what I have so far set hour=%time:~0,2% if "%hour:~0,1%" == " " set hour=0%hour:~1,1% echo hour=%hour% set…
Steve
  • 1,028
  • 7
  • 25
  • 42
-1
votes
2 answers

BCP converting DATE to VARCHAR

I can't save file. I don't know why DECLARE @allquery varchar(8000) SET @allquery = ' bcp "SELECT ''a'' UNION ALL SELECT ' + CAST(CAST(GETDATE()as date) as char(200)) + ' FROM rozklad.dbo.rozklad" queryout D:\bcp\tmp.txt -S '+@@SERVERNAME+' -T -w…
IDK
  • 13
  • 5
-1
votes
1 answer

Sql Server reporting services over bcp

Currently in our organisation we aren't using reporting services in Sql Server anywhere. I have a task where i need to fetch data using a query and dump it to some local drive on daily basis. All the dump task currently are done using bcp utility.…
Tanu Jain
  • 107
  • 1
  • 3
  • 11
-1
votes
1 answer

bcp utility with Visual C#

I try to use SQL Server bcp utility in Visual C# like this: command = new SqlCommand ("bcp "+ onlineConnect.Database+".dbo.T1 out "+ ConfigurationManager.AppSettings ["caleonline"]+"T1.dat -n -S " + onlineConnect.DataSource+" -U sa -P a"…
atty
  • 1
  • 2
-1
votes
1 answer

How to execute SQL query using SQLCMD with different user

I have requirement to run a SQL query on specific time daily and generate an output file. I'm already using bcp tool inside query to generate report. But, problem is, script is not generating output until I ran it using below command. So, problem…
Ravi
  • 30,829
  • 42
  • 119
  • 173
-1
votes
1 answer

BCP text file with special characters (SQL Server)

I'm stuck at a very simple bcp and am hoping someone here could tell what i am doing wrong... I have a single column textfile contaning email addresses. I'm trying to BCP this to SQL server using "bcp" command. Below is the sample file and the…
BRZ
  • 695
  • 4
  • 13
  • 25
-1
votes
2 answers

Fixed length Bulk Import with BCP format file

I have a huge fixed length flat file with no column delimiters, I am trying to port this data into a table using BCP utility. Below is my sample format I created with BCP :
asp.nerd
  • 23
  • 2
  • 6
-2
votes
2 answers

SQL Server BCP format file could not be opened. Invalid name specified or access denied

My SQL Server table has an Image datatype column containing PDF's and I am trying to restore (export) them but I get stuck. I tried different methods using BCP in SSMS but every time I export the file it is either 0 kb in size or few kb (5-10) less…
-2
votes
1 answer

SQL Server BCP reduce output file size

I'm trying to optimize an hourly txt file export and reduce the file size on SQL Server 2008 R2. I created a job which is calling the below BCP: EXECUTE master.dbo.xp_cmdshell 'BCP "SELECT Columns FROM table queryout D:\OUTPUT\Filename.txt -S…
Merka
  • 11
  • 1
  • 5
-2
votes
1 answer

How to add sysdate from bcp

I have a .csv file with the following sample data format: REFID|PARENTID|QTY|DESCRIPTION|DATE AA01|1234|1|1st item|null AA02|12345|2|2nd item|null AA03|12345|3|3rd item|null AA04|12345|4|4th item|null To load the above file into a table I am using…
dildeepak
  • 1,349
  • 2
  • 16
  • 34
-2
votes
1 answer

On Unix server: unable to parse currency symbol(£,€) from json to .csv file

Below is my java code public Test parseTest(String test) { Testresult = null; try { result = gson.fromJson(test, Test.class); if (CAT.isDebugEnabled()) { CAT.debug(result); …
Nidhi257
  • 754
  • 1
  • 5
  • 23
-2
votes
1 answer

Export to csv using bulk copy, conversion error

While trying to export a SQL Server table to a .csv file using bulk copy, the following errors occur: Conversion failed when converting the varchar value to data type int. Unable to resolve column level collations Copying starts and then an error…
Temp034
  • 141
  • 11
-2
votes
1 answer

BULK IMPORT the same data multiple times require very different time. Why?

I'm testing the speed of BCP utility. I'm using the same database, table, data file (10 million lines), format file etc. in different experiments. After each experiment, I drop table and create the new one (exactly the same). When BCP utility…
zer_ik
  • 410
  • 1
  • 4
  • 14
-2
votes
1 answer

Why is my bcp query not working?

I'm beginner in C#, I want use the bcp utility in C# and to do so, I wrote this code: string connstr = "Data Source=192.168.50.172;Initial Catalog=CDRDB;User ID=CDRLOGIN;Password=beh1368421"; //string connstr = "Enter your connection string…
user3671271
  • 551
  • 2
  • 8
  • 21
1 2 3
77
78