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
tsql(1) FreeTDS Utilities tsql(1)
NAME
tsql - utility to test FreeTDS connections and queries
SYNOPSIS
tsql { -S servername [-I interface] | -H hostname -p port }
-U username [-P password] [-o options]
tsql -C
DESCRIPTION
tsql is a diagnostic tool provided as part of FreeTDS. It uses the TDS protocol directly to connect to Sybase or Microsoft SQL Servers, and
allows the user to issue queries that test the capabilities of FreeTDS.
tsql is *not* a replacement for a complete isql, such as sqsh (www.sqsh.org). It is designed to rely on the lowest level FreeTDS library,
tdslib, as a way to isolate potential bugs in the protocol implementation.
tsql can be run in two ways, one which uses the freetds.conf and one which connects directly using the server's hostname and port.
When -S is used, FreeTDS uses the freetds.conf (or equivalent) and environment variables in the normal way to determine the server's ip
address and port. You can use -I to specify a filename, overriding FreeTDS's configuration file search algorithm.
The -H and -p parameters are provided especially for troubleshooting new configurations (or servers). Use of these parameters causes
FreeTDS to ignore any freetds.conf and environment variables.
OPTIONS
-S servername
the Database Server to which to connect.
-I interface
a freetds.conf or interfaces file describing servername
-H hostname
the DNS hostname of the server
-p port
the port at which SQL Server is listening
-U username
database login name. If username is not provided, a domain login is attempted for TDS 7+ connections.
-P password
database password.
-L list server "instances" (with -H)
-C prints some of the compile-time configuration parameters.
-o options
apply the options specified to every command.
f No footer [result count]
h No header [titles]
t Print time
v Print version
q Quiet
NOTES
Typing "exit", "quit", or "bye" (or ^D) exits tsql.
Typing "version" displays the TDS protocol version.
Command batches may be separated with "go" or "GO". If "GO", the version string is reported before executing the batch.
After prompting for the password, tsql will attempt to connect to the remote
server.
tsql displays a counter indicating the number of seconds that
it is attempting to connect.
Typically, tsql should immediately respond
with a '1>' prompt.
If you see the counter (1, 2, 3, ...), most likely tsql is unable to connect to the indicated server.
If you can connect with "tsql -S servername", your basic FreeTDS installation is working.
If you have suggestions for ways to make tsql more useful as a diagnostic tool, please recommend them to the FreeTDS mailing list for con-
sideration.
HISTORY
tsql first appeared in FreeTDS 0.60.
AUTHORS
The tsql utility was written by Brian Bruns.
BUGS
Several, to be sure, now that it's documented. :)
doc 13 November 2011 tsql(1)