解决了,我编写了一个shell脚本,内容如下:
#!/bin/sh
#The first arg is the username to operate the database.
#The second arg is the password of the username.
#The third arg is the database name;
#The forth arg is the bcp direction(in or out).
if [ $# -ne 4 ]
then
printf "Usage: bcpsh username password dbname direction([in/out]))\n\n"
exit 1
else
un=$1
pwd=$2
dbname=$3
dt=$4
fi
if [ $dt = "in" ]
then
f=deleteScript.sql
printf "------------------------------------------------"
printf "\nDeleting the old data ...\n" "$f"
while read tname
do
printf "DELETE FROM $tname \ngo\n" >> $f
done < tList.cfg