Wednesday, April 6, 2022

Data Select From  SAP-IQ And Insert into Windows MS-SQL


#######################################################

function iq_select

{

echo "SELECT * ISTNO, YIL, AY, GUN, SAAT, DAKIKA, KAYIT_TURU, ORT_RUZGAR_YONU, ORT_RUZGAR_HIZI, MAKS_RUZGAR_YONU, MAKS_RUZGAR_HIZI, TOPLAM_YAGIS, SICAKLIK, NEM, convert(varchar,TARIH,20) FROM AA WHERE YIL=2022 and ay>1 and ISTNO between 17100 and 17102 " > $sql

 echo "go" >>$sql

/usr/local/bin/bsqldb -U user -S dbserver -P password -i $sql -o aa.txt -t "|" -q

sed -i 's/NULL//g' aa.txt

}

#######################################################

function sql_load 

{

freebcp table1 in aa.txt -S Mssqlsrv -U user -P password -c -b 1000 -t '|'

}

#######################################################
iq_select
sql_load