Solved

bcp

Posted on 1998-12-25
2
638 Views
Last Modified: 2010-04-21
I want to bcp a text file to sybase using shell script.
Can any body help, how to bcp a file in C shell script.

thanx
0
Comment
Question by:anilkumarv
2 Comments
 
LVL 3

Expert Comment

by:elfie
ID: 2008522
sorry don't know bcp? can you give a short explanation?
0
 

Accepted Solution

by:
rballen earned 10 total points
ID: 2008523
I am currently in the Informix & Oracle database environment, but I was able to find some old notes when I used Sybase.  This example is k-shell (ksh) but could be modified with little effort to get it to c-shell (csh).  Also, when you execute the bulk copy, be aware of the indexes.  If you have lots of data, drop your indexes before you bcp.  When it finishes, create your indexes.  Maintaining the indexes as you go with the bcp could add LOTS of time to your load.  Good luck ...

#!/bin/ksh
#set -x

###########################################################################
#                                                                         #
# Script..: load.sh                                                       #
# Date....: 12/30/98                                                      #
# Author..: Ray Allen                                                     #
# Desc....: This script will load a SYBASE table via the bcp utility.     #
#------------------------M O D I F I C A T I O N S------------------------#
# SE   Date   Description                                                 #
# -- -------- ----------------------------------------------------------- #
# RA 05/07/97 Created as new.                                             #
###########################################################################
tput clear

database="eicjbl03"
table="NBLT0A1"
load_file="/work/rallen/nblt0a1.txt"
delimiter="^"
logonid="eicjibsv"
password="teamibsv"
row_err="/tmp/row_errors.txt"
std_err="/tmp/std_errors.txt"

echo "Preparing to load table ${table} in database ${database}."
echo "Use input file ${load_file}.\n"

sleep 5

bcp ${database}..${table} in ${load_file} -c -A 8192 -t ${delimiter} \
    -U ${logonid} -P ${password} -e ${row_err} -o ${std_err}

echo "Bulk Copy complete. Review messages in ${row_err} & ${std_err}.\n"

exit 0


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
cant install flashplugins for firefox in freebsd 8 9 44
Compare if date string is within text file 3 59
Unix Question 19 44
Martian Packets Unix 5 28
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

932 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now