isql input file with multiple sql statements


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting isql input file with multiple sql statements
# 1  
Old 02-16-2009
isql input file with multiple sql statements

I've got:
isql -U $USERID -S $SERVER -D $DATABASE -i inputfile.sql -o outputfile.txt

in inputfile I have:
go
sql#1
go
sql#2
go
sql#3
go

I also tried without "go" and with";" instead which did not work
SQL statements will work if I paste them directly into the script and use EOF

Any ideas why they won't work as an input file?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regarding file input to SQL from command line

Hi friends, Need your help again to get a best approach for the below scenario. I am previously having one shell script which accepts request_id/s as the command line argument. single req_id arg= 1111 Multiple arg= 1111,2222,3333 which gets passed to the embedded sql inside to... (9 Replies)
Discussion started by: Showdown
9 Replies

2. Shell Programming and Scripting

Create SQL DML insert statements from file using AWK or similar

Hi all. This is my first post on this forum. I've previously found great help in the huge knowledgebase that is here, but this time I have not been able to find a solution to my problem. I have a large text file that looks like this: typedef struct ABC_struct_nbr1_ { char attr1; /*... (0 Replies)
Discussion started by: Yagi Uda
0 Replies

3. UNIX for Dummies Questions & Answers

SQL Script to use variable value from input file

Here is the requirement, When I run the "run file KSH (sql)", it should substitute '${pCW_Bgn_DT}' with 201120 and '${pCW_End_DT}' with 201124 Input File ---------- $ cat prevwk.dat 201124 20110711 run file KSH (sql) ------------------ In this file, I want to use the variables... (1 Reply)
Discussion started by: shanrice
1 Replies

4. Shell Programming and Scripting

How to use sql data file in unix csv file as input to an sql query from shell

Hi , I used the below script to get the sql data into csv file using unix scripting. I m getting the output into an output file but the output file is not displayed in a separe columns . #!/bin/ksh export FILE_PATH=/maav/home/xyz/abc/ rm $FILE_PATH/sample.csv sqlplus -s... (2 Replies)
Discussion started by: Nareshp
2 Replies

5. Shell Programming and Scripting

Multiple if statements in script and unexpected end of file

Two things... 1) If I have an if statement that is true I want it to exit without running the rest of the file, but if it is false I want it to continue.. I just did if ; then exit else echo "" fi Can that work? I want it to exit if $1 is 0, and if not to continue running the rest of the... (1 Reply)
Discussion started by: glev2005
1 Replies

6. Shell Programming and Scripting

Remover Banner and SQL prompt from isql

Hi, I am using isql and putting the output in a file in a shell script in Linux. However in my output i am getting the banner and a SQL prompt(at the start and the end of query output) +---------------------------------------+ | Connected! | | ... (6 Replies)
Discussion started by: lifzgud
6 Replies

7. UNIX for Dummies Questions & Answers

store SQL statements and results in a file

Hello Guys... I want a small help from you guys. Actually in Oracle, we are having a utlity called spool through which can store whatever SQL statements executed and other queries and the output of those queries in a file So, similarly in Unix, if I start a session executing a number of Unix... (2 Replies)
Discussion started by: mraghunandanan
2 Replies

8. Shell Programming and Scripting

put value of multiple sql statements into unix variables

i want to use multple sql count statements and store these count values in unix variable but in one connection only i.e. in only 1 time database should be hit ,which is the main requirement. (1 Reply)
Discussion started by: sw@pnil
1 Replies

9. Solaris

bcp and isql for MS SQL Server on Solaris?

After dumping data from an Oracle database running on Solaris into a flat file, we need to run bcp and isql for MS SQL Server on the same Solaris box. Does Microsoft provide some tools that run on Unix? Thanks for your assistance. (2 Replies)
Discussion started by: tomstone_98
2 Replies

10. Solaris

Automate SQL statements

Hello, On unix side, I have written below script for taking oracle db backup. But when I tried to execute it - i could not execute the sql statements from unix. Please suggest ------------------------ $ more bkp.sh #!/bin/ksh # make sure database is shutdown cleanly sqlplus '/ as sysdba'... (3 Replies)
Discussion started by: panchpan
3 Replies
Login or Register to Ask a Question
isql(1) 						       UnixODBC manual pages							   isql(1)

NAME
isql, iusql - unixODBC command-line interactive SQL tool SYNOPSIS
isql DSN [USER [PASSWORD]] [options] DESCRIPTION
isql is a command line tool which allows the user to execute SQL in batch or interactively. It has some interesting options such as an option to generate output wrapped in an HTML table. iusql is the same tool with built-in Unicode support. ARGUMENTS
DSN The Data Source Name, which should be used to make connection to the database. The data source is looked for in the /etc/odbc.ini and $HOME/.odbc.ini files in that order, with the latter overwriting the former. USER Specifies the database user/role under which the connection should be made. PASSWORD Password for the specified USER. OPTIONS
-b Run isql in non-interactive batch mode. In this mode, the isql processes its standard input, expecting one SQL command per line. -dDELIMITER Delimits columns with delimiter. -xHEX Delimits columns with HEX, which is a hexadecimal code of the delimiting character in the format 0xNN - i.e. 0x09 for the TAB char- acter. -w Format the result as HTML table. -c Output the names of the columns on the first row. Has any effect only with the -d or -x options. -mNUM Limit the column display width to NUM characters. -lLOCALE Sets locale to LOCALE. -q Wrap the character fields in double quotes. -3 Use the ODBC 3 calls. -n Use the newline processing. -e Use the SQLExecDirect instead of Prepare. -k Use SQLDriverConnect. -v Turn on the verbose mode, where the errors are fully described. Useful for debugging. --version Prints the program version and exits. COMMANDS
This section briefly describes some isql runtime commands. help List all tables in the database. help table List all columns in the table. help help List all help options. EXAMPLES
$ isql WebDB MyID MyPWD -w -b < My.sql Connects to the WebDB as user MyID with password MyPWD, then execute the commands in the My.sql file and returns the results wrapped in HTML table. Each line in My.sql must contain exactly 1 SQL command, except for the last line, which must be blank (unless the -n option is specified). FILES
/etc/odbc.ini System-wide DSN definitions. See odbc.ini(5) for details. $HOME/.odbc.ini User-specific DSN definitions. See odbc.ini(5) for details. SEE ALSO
odbcinst(1), odbc.ini(5) AUTHORS
The authors of unixODBC are Peter Harvey <pharvey@codebydesign.com> and Nick Gorham <nick@easysoft.com>. For the full list of contributors see the AUTHORS file. COPYRIGHT
unixODBC is licensed under the GNU Lesser General Public License. For details about the license, see the COPYING file. version 2.3.1 Tue 25 Jun 2013 isql(1)