Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

bcp

Posted on 1998-12-25
2
Medium Priority
?
682 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 20 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
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 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.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

886 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