11-14-2007
isql query in unix shell script
Dear all
I want to execute some isql command from unix shell script. Kindly suggest me. isql command mention below.
isql -U -P
use gdb_1
go
select count (*) from table_x
go
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi
I want to get the a field from a SQL query into unix shell script variable. the whole situation is like this.
1. Opened a cursor to a table in DB2 databse.
2. Fetching individual rows with the help of cursor.
3. Each row has 4 fields.
I want each of the field in individual shell... (1 Reply)
Discussion started by: skyineyes
1 Replies
2. Shell Programming and Scripting
I want to write a script to go to particular path in file and run shell script from there.
what will be shell script for the same. (2 Replies)
Discussion started by: shekhar_ssm
2 Replies
3. Shell Programming and Scripting
Hi All-
First time using iSql.
I have 4 query files - some have more than 1 line of sql statements
After a bit of research it appears I can just use the -i command and specify the input file.
Questions:
Does it matter that there are multiple queries in each file? Do I need to have... (3 Replies)
Discussion started by: Cailet
3 Replies
4. UNIX for Dummies Questions & Answers
I want to perform few post-session success tasks like update a status to 'true' in one of the sql database table, update date values to current system date in one of the configuration table in sql. How do i achieve this in a post session command?syntax with example will be helpful. (3 Replies)
Discussion started by: nathanvaithi
3 Replies
5. Shell Programming and Scripting
Hi
i want write a script for list of sysbase are having access or open.
then i wrote like:
USER="abc"
PASS="xyz"
SERVER="SCCS"
DB="blue"
WORK_DIR="/usr/home/ramakrishna"
set -x
isql -U${USER} -P${PASS} -S${SERVER}<<EOF>$WORK_DIR/output.log
go
use blue (database name)
go
use... (0 Replies)
Discussion started by: koti_rama
0 Replies
6. Shell Programming and Scripting
Hi
I wrote a script for connecting isql(Sybase database) and stored the SQL output in Unix box.
my script:
isql -U${USER} -P${PASS} -S${SERVER} <<EOF > $WORK_DIR/out1.log
go
select convert(varchar(10),sdcurrent,101) from pr_sysdate
go
exit
EOF
Unfortunately, the output file not... (5 Replies)
Discussion started by: koti_rama
5 Replies
7. Shell Programming and Scripting
Hi All,
O/S: Linux 86x64 Red Hat
I have a sql script that queries top consuming processes of Linux using TOP commnd.
Now I need to automate this task and pass the top processes i.e., PID to the sql script through unix shell script.
Could anyone please let me know how to achieve this.
... (2 Replies)
Discussion started by: a1_win
2 Replies
8. Shell Programming and Scripting
Hello
I am not able to get the isql output to temp_res file ... i have tried all the different combinations as shown below, but could not get anywhere .... Please Help
isql -S $serv_name -U $usr_name -P $pswd -D $db_name -o temp_res << EOF1
select status from modset where... (1 Reply)
Discussion started by: gkrish
1 Replies
9. Shell Programming and Scripting
Hi Guys,
I need help with my code.
I am not able to find what the error is (tried debugging and everything).
#! /bin/sh
# MODSET_CLOSE
# Usage: modset_close
echo "Enter the Type of Modsets that needs to be Closed: "
read mod_typ
serv_name=`cat $mod_typ | awk '{ print $1 }'`... (5 Replies)
Discussion started by: gkrish
5 Replies
10. Shell Programming and Scripting
need to create shell script to read the table's name from file and connect SQL SERVER using isql (odbcunix)
i 'm able connect to database with below command line syntex but i could not get working in shell script with SQL and storing the row count in variable.
isql -v DSN USERNAME PASSWD
... (6 Replies)
Discussion started by: pimmit22043
6 Replies
fisql(1) FreeTDS Utilities fisql(1)
NAME
fisql - interactive SQL shell
SYNOPSIS
fisql [-e] [-F] [-g] [-p] [-n] [-v] [-X] [-Y]
[-a display_charset] [-c cmdend]
[-D database] [-E editor]
[-h headers] [-H hostname] [-i inputfile]
[-I interfaces_file] [-J client_charset]
[-l login_timeout] [-m errorlevel]
[-o outputfile]
[-P password] [-s colseparator] [-S server]
[-t timeout] [-U username] [-w width]
[-y sybase_dir] [-z language]
DESCRIPTION
fisql is very similar to the "isql" utility programs distributed by Sybase and Microsoft. Like them, fisql uses the command "go" on a line
by itself as a separator between batches.
OPTIONS
-a display_charset
The client charset name. Not implemented.
-c cmdend
Command terminator, defaults to go.
-D Database name on the server to use.
-e Echo SQL input (usually in outputfile)
-E editor
Specify an editor to invoke. Defaults to vi.
-F FIPS mode ON. Server returns a message (but processes the query anyway) when it encounters a non-standard SQL command.
-g Display a brief help message
-h headers
Number of rows after which to repeat the column headers. Default is once per resultset.
-H hostname
Hostname of the client machine as it will be told to the server.
-I interfaces_file
Name of the interfaces or freetds.conf file to use.
-i inputfile
Name of script file, containing SQL.
-J client_charset
Not implemented.
-l login_timeout
How long to wait for the server to acknowledge a login attempt.
-m errorlevel
For errors of the severity level specified or higher, print only the message number, state, and error level. Below that level,
print nothing.
-n Suppress line numbers in echoed output.
-o outputfile
Name of output file, holding result data.
-p Prints performance statistics. Not implemented.
-P password
Database server password.
-s colseparator
The column separator. Default is space. Shell metacharacters require quoting.
-S server
Database server to which to connect.
-t timeout
The query timeout, in seconds. How long to wait for a query to be processed. The default is indefinitely, or as determined by
freetds.conf.
-U username
Database server login name.
-v Display version and copyright.
-w width
How many characters wide to print the output. Defaults to 80.
-X Use encrypted login. Not implemented in FreeTDS.
-y sybase_dir
Sets the SYBASE environment variable. Not used by FreeTDS.
-Y Use chained transactions.
-z language
Name of a language for fisql's prompts and messages. Cf. DBSETLNATLANG.
NOTES
fisql is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The -i, -o, and -e options
override these, of course.
fisql uses the db-lib API provided by FreeTDS. It was first implemented using Sybase's own library and continues to work with it. Before
(and after) modifying it, it would be well to test it with Sybase's library to assure compatibility between it and FreeTDS.
EXIT STATUS
fisql exits 0 on success, and >0 if the server cannot process the query.
fisql will report any errors returned by the server, but will continue processing. In a production environment, this behavior may be insuf-
ficiently stringent. To make it extremely intolerant of errors, change the message and error handlers to call exit(3).
HISTORY
fisql first appeared in FreeTDS 0.65.
AUTHORS
The fisql utility was written by Nicholas S. Castellano <entropy@freetds.org>, who contributed it to the FreeTDS project under the terms of
the GPL.
BUGS
Requires the GNU readline library.
doc 13 November 2011 fisql(1)