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

Unprintable characters in bcp.exe output

I want is to dump three MSSQL Server tables using a batch job. I searched around and found bcp is highly recommended for this kind of work. Looking at the documentation, it seemed what I wanted was to dump the entire table, because I wanted all the…
octopusgrabbus
  • 10,555
  • 15
  • 68
  • 131
0
votes
1 answer

Best way to load CSV files into SQL Server 2008?

I've got a script that's scraping CSV files. Each day I get 36 individual CSV files, each with about 100 lines of data. I want to load these into SQL Server 2008 each day. I've tried using Bulk Insert, but it doesn't like my CSV files very much,…
user1745767
  • 1,061
  • 2
  • 11
  • 16
0
votes
0 answers

Bulk Insert column is too long

I have a text file with fixed length data. Here's my table: create table myBulkInsert( MaxData Varchar(Max) ) x.fmt contains: 10.0 1 1 SQLCHAR 8 0 "" 1 MaxData SQL_Latin1_General_CP1_CI_AS When I…
Phillip Senn
  • 46,771
  • 90
  • 257
  • 373
0
votes
1 answer

bcp utility outputs an empty file

I will use the bcp utility to debug a stored procedure, so I'd like export some data to a file. I ran a test into my SQL-Server 2005 DECLARE @SQL VARCHAR(8000) SELECT @SQL = 'BCP "SELECT 1" QUERYOUT "D:\test.txt" -C -T' EXEC MASTER..XP_CMDSHELL…
serhio
  • 28,010
  • 62
  • 221
  • 374
0
votes
0 answers

Can't write bcp export file from MSSQL

Okay. I'm at wit's end and haven't found a posting that addresses my problem completely. I'm new to C# and I'm unfamiliar with databases. What I do know is I must output a data file into a 'native' format (instead of ASCII which is why I assume I…
Erik
  • 503
  • 1
  • 7
  • 26
0
votes
1 answer

SQL bulk insert using bcp between servers through script without using linked server

SQL bulk insert using bcp between servers through script without using linked server. I'm trying to use the following queries: bcp AdventureWorks.dbo.BuildVersion out Currency.dat -U sa -P 123456 -c -[cespl-pc130] bcp…
venkat
  • 178
  • 2
  • 12
0
votes
1 answer

What is the most secure way to allow users to execute BCP export command from SQL?

I am currently working in an environment where the ability to export a table programatically from within a hand-run SQL script would be of great help. Performing the exports from script will be the first step towards running the entire process…
samaspin
  • 2,342
  • 1
  • 26
  • 31
0
votes
2 answers

In SQL Server 2000 how to convert table to text file

In SQL Server 2000, I need to convert a table data (whole, not partial) to a text file (csv or tab). How can I do this with a table (tblCustomer) which has name, address, phone number, for example? I don't use SQL Server Management Studio. I have…
user1364865
  • 21
  • 1
  • 5
0
votes
1 answer

BCP IN UTC Date Time values in SQL Server

I've been using the following BCP command for a long time, but the producers of my data changed the date time format of the data and now it fails with invalid cast specifications. Does anyone know how I can BCP in the data shown below given that the…
John Humphreys
  • 37,047
  • 37
  • 155
  • 255
0
votes
2 answers

SQL server table to FoxPro table issues

I am trying to get some SQL server tables into FoxPro dbf. I successfully managed to bcp export data such that when I use FoxPro Import Wizard, the data imports correctly. But when I try to do it at the command line, I can at best import the…
RIDER
  • 159
  • 3
  • 9
0
votes
1 answer

Sending null values to an integer column in an SQL table from a C++ application

I am doing a bulk copy of program variables to a SQL Server 2005 table and I use bcp_bind and bcp_sendrow in a C++ application However, some of the integer columns in the table allow null values. I'm not quite sure how I should be sending null…
dingo
  • 1
  • 4
0
votes
1 answer

sql server 2008: bcp_sendrow, issue: invalid time format

I'm having a problem "Invalid time format" when I try to use bcp functions(bcp_sendrow/bind etc.) to insert into a table having a datetime column. so as per googled examples, I populated a DBDATETIME structure, for example: if I wanted to populate…
ppx
0
votes
2 answers

SQL Server: BULK INSERT from file that contains dates in format YYYYMMDD

Possible Duplicate: bulk insert a date in YYYYMM format to date field in MS SQL table I am using SQL Server 2012 Express. I have a problem with using BULK INSERT from file that contains dates in format YYYYMMDD (can't change the format, it's an…
user1603038
  • 2,103
  • 3
  • 19
  • 29
0
votes
2 answers

exec master..xp_cmdshell bcp select

Below, I'm calling one stored procedure from c#.net windows forms. The stored procedure contains following: exec master..xp_cmdshell ''bcp "select…
kishore
  • 108
  • 1
  • 3
  • 12
0
votes
1 answer

How to get the "CREATE TABLE" query?

When I right-click on my view and click on "Script View As", I get the following error: Property TextHeader is not available for View '[dbo].[TableName]'. This property may not exist for this object, or may not be retrievable due to…
Legend
  • 113,822
  • 119
  • 272
  • 400