Unix HP상에서 IQ12의 SQL를
in.sh파일로 만들어 실행할려고 합니다.
insert into xx
select * from xx_01
초보라서 in.sh 만 실행하면 SQL문이 실행되는 셀 작성방법좀알려주시면 감사하겠습니다.
자세히 알려주시면 더욱 감사하겠습니다.
isql -Usa -Pxxxx << __EOF
use db_name
go
insert into xx select * from xx_01
__EOF
를 in.sh로 저장후 chmod 777 in..sh를 한후 $in.sh 하거나
$sh in.sh로 실행하면 됩니다.
iq에서는 use db_name이 없지요 ???? (ASE 기준 입니다)
출처 : http://www.ianywhere.com/developer/product_manuals/sqlanywhere/1000/en/html/dbdaen10/da-dbisqlc-interactive-dbutilities.html dbisqlc [ options ] [ dbisqlc-command | command-file ]
Option Description -c "keyword=value; ..." Supply database connection parameters. -d delimiter Use the given string as the command delimiter. -q Run in quiet mode?do not display messages or windows. (Note that this does not suppress error messages.) -x Syntax check only?no commands executed.
Examples The following command, entered at a command prompt, runs the command file mycom.sql against the current default server, using the user ID DBA and the password sql. If there is an error in the command file, the process terminates.
dbisqlc -c "UID=DBA;PWD=sql" mycom.sqlThe following command, when entered on a single line at a command prompt, adds a user to the current default database:
dbisqlc -c "UID=DBA;PWD=sql" GRANT CONNECT TO joe IDENTIFIED passwd ㅇ 사용예 : - 유닉스상에서 a.sh 파일을 만들고 다음 내용을 입력 dbisqlc -c dsn=xxx -q sql파일명 (여기서 xxx는 위 설명처럼 연결 파라미터) - 파일실행: sh a.sh(또는 a.sh를 실행권한을 준후 a.sh를 직접 실행)