get values from isql query


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting get values from isql query
# 1  
Old 05-24-2005
get values from isql query

hi all

i have an isql sentence in a ksh script, what get some values from my database (Sybase IQ 12.5 - solaris 5.7)

how can i read this sql results??? do i have to do a while?? a for???
where do i put the values??

my idea is put them in an array, is that possible?


please, help me
any idea, thanks

jona
# 2  
Old 05-24-2005
Something to get you started...
Code:
$ more testisql.ksh
#!/bin/ksh

results=`isql -Usa -Pmy_sa_password_goes_here <<EOF
select name from sysobjects where type = "U"
go
EOF`

line_count=0
echo "${results}" | while read line; do
   echo "Line $((line_count = line_count + 1)) is ${line}"
done

exit 0
$ ./testisql.ksh
Line 1 is name
Line 2 is ------------------------------
Line 3 is spt_values
Line 4 is spt_monitor
Line 5 is spt_limit_types
Line 6 is syblicenseslog
Line 7 is spt_ijdbc_table_types
Line 8 is spt_ijdbc_mda
Line 9 is spt_ijdbc_conversion
Line 10 is ijdbc_function_escapes
Line 11 is spt_jdbc_table_types
Line 12 is spt_mda
Line 13 is spt_jtext
Line 14 is spt_jdbc_conversion
Line 15 is jdbc_function_escapes
Line 16 is 
Line 17 is (13 rows affected)

Cheers
ZB
# 3  
Old 04-26-2006
Hi can you tell me if there is a sybase sql client (iSQL) that works with SCO6 and if so where can I download it from?
# 4  
Old 06-27-2008
I need help badly

Hi

I am getting leading spaces when i excecute a query in ISQL,is there any option to remove that while in ISQL itself


|LU0001749554|Luxembourg Stock Exchange|Luxembourg Stock Exchange|4081045||D03363767802
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Maximum of the values from the output a query

Following is the output of a command ran inside the script: 2015-01-29-05-38-02 5 2015-01-29-05-38-02 5 2015-01-29-05-38-02 5 2015-01-29-05-38-02 5 2015-01-29-05-38-02 5 2015-01-29-05-38-03 5 2015-01-29-05-38-03 5 2015-01-29-05-38-03 5 2015-01-29-05-38-03 5 2015-01-29-05-38-03 5... (8 Replies)
Discussion started by: Devendra Hupri
8 Replies

2. Programming

Query SQL get two values differents from the same columns

Hi, I have 2 different values in the same column and two different values in other column Query 1 ins name value 1 Test 12345 1 TestV1 12/10/2014 8 Test 85435 8 TestV1 11/11/2005 9 Test 42232 9 TestV1 19/10/2000 6 Test 54321... (6 Replies)
Discussion started by: faka
6 Replies

3. Shell Programming and Scripting

Insert bulk values in DB table using isql

Hello, Objective is to insert bulk values in DB table using isql. Following code tried: isql -SServer_name -Ddb_name -Uuser_name -Ppassword < file.txt cat file.txt for i in `cat data_value_file.txt` do insert into tempdb..temp_table11 values ('$i') go done cat... (3 Replies)
Discussion started by: manishdivs
3 Replies

4. Shell Programming and Scripting

Reading values from sql query

I have sql query in shell script. select distinct account_no from adj order by account_no; This query returns account number daily.Sometimes it may return 90 rows sometime it may return 1 row only and someday it may return 0 rows I am storing the output of this query in sql_output.txt. ... (5 Replies)
Discussion started by: rafa_fed2
5 Replies

5. Shell Programming and Scripting

Values passing out of isql session

hi .. i have a isql session which inside which i have two variables defined.. i wanna calculate % based on those variables. i knw i can easily do % calculation in csh if i could get the value of these variables passed outside the isql session . is tat possible ?? pls advice somthin like below... (1 Reply)
Discussion started by: Rahul619
1 Replies

6. Shell Programming and Scripting

Query the table and return values to shell script and search result values from another files.

Hi, I need a shell script, which would search the result values from another files. 1)execute " select column1 from table_name" query on the table. 2)Based on the result, need to be grep from .wft files. could please explain about this.Below is the way i am using. #!/bin/sh... (4 Replies)
Discussion started by: Rami Reddy
4 Replies

7. Shell Programming and Scripting

Isql query in unix shell

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

8. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

Hi, I have a requirement as below which needs to be done viz UNIX shell script (1) I have to connect to an Oracle database (2) Exexute "SELECT field_status from table 1" query on one of the tables. (3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies

9. 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

10. Shell Programming and Scripting

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 (3 Replies)
Discussion started by: jaydeep_sadaria
3 Replies
Login or Register to Ask a Question