Sponsored Content
Top Forums Shell Programming and Scripting How to assign record count output of isql to a shell variable ? Post 302424810 by vikram3.r on Wednesday 26th of May 2010 10:37:29 AM
Old 05-26-2010
Quote:
Originally Posted by durden_tyler
In version 11.0.x and higher, specify "set nocount on" option to suppress the rows affected line.

In pre 11 versions, use sed to delete the lines that have the word "affected" in them.

tyler_durden

Is there any option like ,
establishing isql connection only once, and executing multiple queries and getting their respective record counts in separate variables...?
My need is like,
isql >>
recordcount1= query1
recordcount2= query2
>>

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to assign an output to a variable

Hi, I am giving a grep command, and i am getting the output. i want to store it in a variable for eg a = grep '12345' /dir/1/2/log.txt ( the output is number) b= grep 'basic' /dir/1/2/log1.txt (in this case the output is character) so how to assign the output of grep to a variable ... (1 Reply)
Discussion started by: vasikaran
1 Replies

2. Shell Programming and Scripting

how to assign sql output data to shell script variable

Hi Guys ! I am new to unix and want to find out how we can make sql statement data to shell script variable? Any help/suggestion is greatly appreciated -Chandra (1 Reply)
Discussion started by: kattics
1 Replies

3. Shell Programming and Scripting

Setting value of Shell variable from within ISQL

Hi Guys, Need help. I am using ISQL inside a shell script. Is there a way to set the value of shell script variable from inside the ISQL code. I do not want to write the results from the SQL to an output file. Please let me know. Regards, Tipsy. (3 Replies)
Discussion started by: tipsy
3 Replies

4. Shell Programming and Scripting

Need help with Isql record count

What I am trying to do is check if the database query returned any records. If no records returned then output a message else output results to a file. Right now if I take out the if and else statements the code runs fine and sends the email. If no records returned the email sends the column... (4 Replies)
Discussion started by: johnu122
4 Replies

5. Shell Programming and Scripting

Setting variable for query using iSql / Korn Shell

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

6. Shell Programming and Scripting

Assign perl output to ksh shell variable

Hello, I am writing a ksh script on an AIX system. I need to get the date and time from a file into a variable. I found the following perl script from another post on this site and modified it slightly to output the format I need: perl -e '@d=localtime ((stat(shift)));... (4 Replies)
Discussion started by: swimp
4 Replies

7. UNIX for Dummies Questions & Answers

how to use shell variable in isql

Hi , I want to use shell variable in isql. example.. $ksh ./sudh.ksh "2041qwer" sudh.ksh is my script passing the perameter "2041qwer" Code in my script : =========== $SYBASE/$SYBASE_OCS/bin/isql -I$SYBASE/interfaces -S$OTHRSRVR -U$SYBUSER -P$SYBPASS -w... (1 Reply)
Discussion started by: sudhakarpasala
1 Replies

8. Shell Programming and Scripting

How to assign value from isql to UNIX variable

I want output to be assigned to UNIX variables echo "Enter RRS ID: " read rrs isql -SPROD_DDS -USYBUSER -PSYBPASS -b -osfg.out << EOF use sip go set nocount on select issuerId, legalStructTxt, productName, issuerName from sf_product where rrsId = $rrs go EOF (1 Reply)
Discussion started by: JayDoshi
1 Replies

9. Shell Programming and Scripting

Return value inside isql to a shell variable in ksh

Hello, I have a shell script where I am doing an isql to select some records. the result i get from the select statement is directed to an output file. I want to assign the result to a Shell variable so that I can use the retrieved in another routine. e.g. "isql -U${USER} -P${PASSWD} -S${SERVER}... (1 Reply)
Discussion started by: RookieDev
1 Replies

10. Shell Programming and Scripting

How to get the output of a ISQL command in a variable?

I am trying to run a query which returns a sum value(a number). I want to get it in a variable so that i can refer to that variable in different places. when i am running the following command variable=`isql -Uuser -Sserver -Ppassword 1> select sum(count(*)) from xyz..abc where clm_id... (2 Replies)
Discussion started by: Sharma331
2 Replies
osql(1) 							 FreeTDS Utilities							   osql(1)

NAME
osql - utility to test FreeTDS connections and queries SYNOPSIS
osql -S dsn -U username -P password [-I ini_dir] DESCRIPTION
osql is a diagnostic tool provided as part of FreeTDS. It is a Bourne shell script that checks and reports on your configuration files. If everything checks out OK, it invokes isql. osql works only with the isql that comes with unixODBC. OPTIONS
-S dsn the Data Source Name to which to connect, as known to odbc.ini. -U username database login name. -P password database password. -I ini_dir override odbc.ini file location. EXAMPLE
If you have an odbc.ini with a section like this: [myDSN] servername = myserver TDS_Version = 5.0 You would invoke osql as: osql -S myDSN [...] NOTES
If you can connect with "osql -S servername -U user -P passwd", your FreeTDS ODBC installation is working. osql guesses where unixODBC might look for its odbc.ini by examining the binary. This is not always an effective approach. If it doesn't work, you'll receive a report of candidate strings. Kindly pass along the output to help improve the guessing. If osql cannot intuit your odbc.ini directory, you can force the issue with the -I option. However, you're instructing osql what to test, not where unixODBC will eventually look. Your override is therefore only as good as you are. Look carefully at the error output before overriding. If you have suggestions for ways to make osql more useful as a diagnostic tool, please post them to the FreeTDS mailing list. HISTORY
osql first appeared in FreeTDS 0.65. AUTHORS
The osql utility was written by James K. Lowden doc 13 November 2011 osql(1)
All times are GMT -4. The time now is 03:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy