Sponsored Content
Top Forums UNIX for Advanced & Expert Users to create format file for bcp in Post 302292230 by Arunprasad on Friday 27th of February 2009 07:43:58 AM
Old 02-27-2009
Hi all ,

i have tried this command
bcp db..tablename out outpath/outfile.txt -f formatpath/formatfile.FMT -N -Uuser -Sserver -Ppass

I got the below error:
Code:
bcp: Unable to open format-file "formatpath/formatfile.FMT "

Then i created a file "formatfile.FMT" in the formatpath and then tried the same command

getting the different error:
Code:
I/O error while reading bcp format-file.

Please help me.

Last edited by Yogesh Sawant; 04-08-2009 at 07:26 AM.. Reason: added code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to create concatenate a file in tab format

Hi, Do you know given a file which is SED at the same time, how to read it and AWK it in tabs format. Means:- I have an input file which is (at the same time perform sed):- 1 2 3 4 5 6 7 I would like to print out in tab format which is:- 1 2 3 4 5 6 7 .... (12 Replies)
Discussion started by: ahjiefreak
12 Replies

2. Shell Programming and Scripting

create filename with 'DD/MM/YYYY' date format

Hi, I can use the following command to create a file with some name then underscore and then date appended to it in the format 'DD-MM-YYYY': touch "newfile_`date '+%d-%m-%Y'`" But it gives me error when I try with the similar command to create a file with the date format 'DD/MM/YYYY'. I... (4 Replies)
Discussion started by: royalibrahim
4 Replies

3. Shell Programming and Scripting

Help to Create this file format structure

This data comes form the table and exported into the file in this format File1 Format weboffercode1,sourcecode1,1,1,1,1,1,1 weboffercode1,sourcecode2,1,1,1,1,1,1 weboffercode1,sourcecode1,1,1,1,1,1,1 weboffercode1,sourcecode3,1,1,1,1,1,1 weboffercode1,sourcecode3,1,1,1,1,1,1 ... (4 Replies)
Discussion started by: enigma_83
4 Replies

4. Shell Programming and Scripting

How to format or create a matrix report from file

Dear Unix champs, I have a input file as attached, i would like to create an report from the file as below FileType | EQUENS0001 | EQUENS0002 | EQUENS1100 | EQUENS0003 --------+-------------------------------------------------------- Msg No |... (3 Replies)
Discussion started by: manas_ranjan
3 Replies

5. Shell Programming and Scripting

how can I bcp out a table into a text file including the header row in the text file

Hi All, I need to BCP out a table into a text file along with the table headers. Normal BCP out command only bulk copies the data, and not the headers. I am using the following command: bcp database1..table1 out file1.dat -c -t\| -b1000 -A8192 -Uuser -Ppassword -efile.dat.err Regards,... (0 Replies)
Discussion started by: shilpa_acc
0 Replies

6. Programming

Create table with date format.

Hello, Could you please let me know the correct format of CREATE TABLE statement with DATE format. CREATE TABLE EMP_TABLE1 ( NAME VARCHAR(6) PRIMARY KEY, ADDRESS VARCHAR(6), BIRTH_DATE DATE ); I want BIRTH_DATE to be in "YYYYMMDDHHMISS" format. How we can create table with... (4 Replies)
Discussion started by: Poonamol
4 Replies

7. Shell Programming and Scripting

Needed touch command to create a file in the following format

needed touch command to create a file in the following format touch a_yyyymmdd_hhmmss (1 Reply)
Discussion started by: hemanthsaikumar
1 Replies

8. Shell Programming and Scripting

Best way to point/update a file during PROD and BCP failover.

Hi All, In UNIX servers we are switching from DR to PROD. After switching to DR we need to update some configuration files which contains the server names. Ex - If we switch to BCP we need to update BCP server name. If we switch back to PROD we need to update PROD server name. I... (1 Reply)
Discussion started by: Girish19
1 Replies

9. Shell Programming and Scripting

How to create a file from output of vertica table query in UTF-8 format?

Hello, In my shell script, I extract table data from HP Vertica DB into a csv file using vsql -c command. But the problem is the file getting created is in binary format and hence some of the data becomes unreadable which has chinese characters as part of data. file -i filename.csv - gives... (2 Replies)
Discussion started by: Dharmatheja
2 Replies

10. UNIX for Beginners Questions & Answers

Create movie from jpg (or other picture format) file

hi linux expert is there any program for create movie file from pictures file (like jpg)? Many Thanks samad (1 Reply)
Discussion started by: abdossamad2003
1 Replies
freebcp(1)							 FreeTDS Utilities							freebcp(1)

NAME
freebcp - bulk loading utility for Sybase and Microsoft databases SYNOPSIS
freebcp [[database.]owner.]object_name {in | [query]out} datafile { -c | -n | -f formatfile } [-b batchsize] [-F firstrow] [-L lastrow] [-e errfile] [-I interfaces] [-m maxerrors] [-t field_term] [-r row_term] [-h hints] [-T textsize] [-A packet_size] [-O options] [-S servername] [-U username] [-P password] [-EdVv] DESCRIPTION
freebcp is a utility program distributed with FreeTDS. freebcp replicates (in part at least) the functionality of the "bcp" utility pro- grams distributed by Sybase and Microsoft. freebcp makes use of the db-lib bcp API provided by FreeTDS. This API is also available to application developers. The manual pages or online help for Sybase or SQL Server can be referenced for more detailed information on "bcp" functionality. TABLES AND FILES
database The database of the object being copied. Optional if the table/view is in the default database for username. owner The owner of the object being copied. Optional if username or the database owner is the owner of the table. object_name Usually, object_name is the name of the database table you wish to access. It can also be a view (and, subject to constraints, it is sometimes possible to load a view). It can also be an SQL query, cf. queryout, below. in | [query]out The direction of the bulk copy operation. 'in' indicates data are to be copied from a host file into a database table; 'out' indi- cates data are to be copied from a database table to a host file. 'queryout' indicates that table_name is in fact a query, rather than a database object. freebcp will execute the query and write the results to a file. (It is a good idea to have the query return one and only one result set.) datafile The name of an operating system file. OPTIONS
-c The host data file is (or will be) in "character" format, i.e., a text file. Encoding is determined by the client charset attribute in freetds.conf. -n The host data file is in "native" format. This is a format that freebcp will be able to process, but is not portable or readable. -f formatfile The format of the host data file is described by formatfile. The layout of formatfile is identical to that understood by the Sybase and Microsoft bcp utilities, but is too complicated to describe here. -b batchsize The number of rows per batch of data copied. Batching applies only when you are bulk copying into the database. Each batch of data is effectively 'committed' into the database. The default value for batchsize is 1000. -F firstrow The first row to copy from the input file or database table. The default is the first row, row 1. -L lastrow The last row to copy from an input file or database table. The default is the last row. -r row_term The row terminator for a character file. May be more than one character. Default is newline (' '). Cf. -c, above. -t field_term The field terminator for character file. Also known as a column delimiter. May be more than one character. Default is tab (' '). Cf. -c, above. -m maxerrors Stop after encountering maxerror errors. Default 10. -e errfile Write errors to error_file. For uploads. Includes line and column information, and the row data. -S servername The name of the Database Server to which to connect. -U username A database login name. If username is not provided, a domain login is attempted for TDS 7+ connections. -P password A database password. -E Write the data in datafile to the table's IDENTITY column. Without this flag, the identity data present in the datafile will be ignored, and new IDENTITY values will be generated for the imported rows. -d Turn off any logging. (Unintuitive, perhaps.) -O options SQL text to set connection options prior to the bcp operation. If options is a valid filename, the SQL is read from the file instead. Sometimes needed for queryout. Example: "-O 'SET QUOTED_IDENTIFIER ON'" -I interfaces The name and location of the interfaces file to search when connecting to servername. Overrides freetds.conf. -h hints Set bcp hints. For valid values, cf. bcp_options() in the FreeTDS Reference Manual. -T textsize For text or image columns, set the maximum number of characters to request from the server. Defaults to the setting in freetds.conf. If not specified anywhere, defaults to the full size of the data. -A packet_size Set the size of a TDS packet to packet_size. Not sure why you would want to do this, except as an experiment. -v -V Print the version information and exit. ENVIRONMENT
DSQUERY default servername NOTES
When connecting to a Sybase database server, it is required that the TDS 5.0 protocol be used. When connecting to a Microsoft SQL Server 2000 database server, the TDS 7.1 protocol is required. Theoretically both Sybase and Microsoft support the TDS 4.2 protocol, but in reality they implement the bcp portion of TDS 4.2 differently. FreeTDS has no way of knowing which type of server it's connected to, hence TDS protocol 4.2 is not supported. HISTORY
freebcp first appeared in FreeTDS 0.60 AUTHORS
The freebcp utility was written by Bill Thompson (thompbil@exchange.uk.ml.com) BUGS
Currently, there is no support for text data types in freebcp, when SQL Server 2000 is the target database. doc 13 November 2011 freebcp(1)
All times are GMT -4. The time now is 09:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy