Execution of the following segment is giving the error -
Script extract:-
OUT=$DATADIR/sol_rsult_orphn.bcp
TMP1=${OUT}_tmp1
TMP=${OUT}_tmp
( isql -w 400 $dbConnect_OPR <<EOF
select convert(char(10), s.lead_id)
+'|'
+ s.pho_loc_type,
";",
s.sol_rsult_cmnt,
";",
+'|'+ s.del_ind
from sol_rsult s
where not exists (select 1 from lead_addl_info a
where a.lead_unique_num = s.lead_unique_num )
and s.emp_id >= 0
go
EOF
) >$TMP1
echo "\n`date +%X` Create a bcp in file having Orphan records starts:"
sed 's/ ; /|/g' $TMP1 > $TMP
Script output:-
19:44:58 Create a bcp in file having Orphan records starts:
=== ERROR generating the file === rc=3.
Please assist.
Error seems to be due to the sytax of the sed command used:-
sed 's/ ; /|/g' $TMP1 > $TMP
Also note that reason for using leading and trailing space for ; is because the output of the sql query gives a space before and after ; in the file.