Solved

bcp

Posted on 1998-12-25
2
623 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
Comment Utility
sorry don't know bcp? can you give a short explanation?
0
 

Accepted Solution

by:
rballen earned 10 total points
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

744 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

15 Experts available now in Live!

Get 1:1 Help Now