问题
I have an sql file that contains below script that is ran via isql. May I ask whats wrong with my output syntax? I am getting "Incorrect syntax near the keyword 'output'"
Sybase ASE version is 15.7
select * from tempdb..M3_STI_extracts_checking
output to employee.txt format ASCII
GO
回答1:
isql offers the possibility to write the output into a file, if you set the option -o
(Utility Commands Reference).
input.sql
select * from tempdb..M3_STI_extracts_checking
go
isql -i input.sql -o employee.txt
-J
sets the charset (ASE 15.7 charsets)
isql -i input.sql -o employee.txt -J ascii_7
回答2:
Was able to workaround by passing the variable from a shell script.
test.sh
output_file=test_file_'date +%m%d%Y'
${PARAM} isql << EOF
select * from tempdb..M3_STI_extracts_checking
GO > ${output_file}
EOF
来源:https://stackoverflow.com/questions/54882905/outputing-select-statement-result-into-file