Solved

bcp

Posted on 1998-12-25
2
667 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
pauing printer deamon in AIX 10 66
Invalid password trying to cannect to Unix server 2 106
Image not there 4 76
leap year shell script 10 52
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
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…
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.:
Suggested Courses

739 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