Solved

bcp

Posted on 1998-12-25
2
656 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

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…
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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…

820 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