#!/bin/sh

#################################
# truncate APPDEMO tables in Y157SP122
#################################

isql -Usa -P -SY157SP122 -DAPPDEMO << EOF
truncate table appdemo.OrderDetails
go
truncate table appdemo.Titles
go
truncate table appdemo.Publishers
go
truncate table appdemo.Authors
go
truncate table appdemo.Orders
go
truncate table appdemo.Stores
go
EOF

#################################
# perform bcp out's (from ORA)
#################################

bcp publishers out ./temp/publishers.dat -Uappdemo -Pappdemo -SORA11DEV -c -T 102400
bcp authors out ./temp/authors.dat -Uappdemo -Pappdemo -SORA11DEV -c -T 102400
bcp orders out ./temp/orders.dat -Uappdemo -Pappdemo -SORA11DEV -c -T 102400
bcp stores out ./temp/stores.dat -Uappdemo -Pappdemo -SORA11DEV -c -T 102400
bcp orderdetails out ./temp/orderdetails.dat -Uappdemo -Pappdemo -SORA11DEV -c -T 102400
bcp titles out ./temp/titles.dat -Uappdemo -Pappdemo -SORA11DEV -c -T 102400

#################################
# perform bcp in's (into Y157SP122)
#################################

bcp APPDEMO.appdemo.Publishers in ./temp/publishers.dat -Usa -P -SY157SP122 -c -T 102400
bcp APPDEMO.appdemo.Authors in ./temp/authors.dat -Usa -P -SY157SP122 -c -T 102400
bcp APPDEMO.appdemo.Orders in ./temp/orders.dat -Usa -P -SY157SP122 -c -T 102400
bcp APPDEMO.appdemo.Stores in ./temp/stores.dat -Usa -P -SY157SP122 -c -T 102400
bcp APPDEMO.appdemo.OrderDetails in ./temp/orderdetails.dat -Usa -P -SY157SP122 -c -T 102400
bcp APPDEMO.appdemo.Titles in ./temp/titles.dat -Usa -P -SY157SP122 -c -T 102400

#################################
# delete data files
#################################

rm ./temp/*
