Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to save isql query results in a Unix-File

2,557 views
Skip to first unread message

Markus Brakweh

unread,
Apr 29, 1993, 8:54:04 AM4/29/93
to

I'm new in using Sybase (Version 4.2 on Sun OS 4.1.3) and I'm astonished
not to find a way for saving isql-query results in a Unix-File.

I didn't find something like 'select * from table into "filename.data"' in
the Manuals.

That was possible in Unify 2000 and I'm sure that I am just to blind to see
the solution.

Thanx in advance for any help.

Markus

---------------------------------------------------------------------
hac...@uni-paderborn.de | Markus Brakweh
| Universitaet-GH Paderborn, FB 17
| Warburger Str. 100
| D-4790 Paderborn, Germany
---------------------------------------------------------------------

Michael Perry

unread,
Apr 29, 1993, 9:11:34 AM4/29/93
to
In article <HACKES.93A...@leo.uni-paderborn.de> hac...@uni-paderborn.de (Markus Brakweh) writes:
>
>I'm new in using Sybase (Version 4.2 on Sun OS 4.1.3) and I'm astonished
>not to find a way for saving isql-query results in a Unix-File.
>
>I didn't find something like 'select * from table into "filename.data"' in
>the Manuals.
>
>That was possible in Unify 2000 and I'm sure that I am just to blind to see
>the solution.
>
>Thanx in advance for any help.
>
>Markus

Write your query in a file filename.sql and try this:

isql -Uuser -Ppassword <filename.sql >results.out

That should capture everything for you.

Mike
--
Michael Perry
Sr. Regional Tech. Support Specialist
Sequent Computer Systems, Inc.
m...@sequent.com

Ali Ghandehi

unread,
Apr 29, 1993, 10:56:32 AM4/29/93
to

I'm new in using Sybase (Version 4.2 on Sun OS 4.1.3) and I'm astonished
not to find a way for saving isql-query results in a Unix-File.

I didn't find something like 'select * from table into "filename.data"' in
the Manuals.

That was possible in Unify 2000 and I'm sure that I am just to blind to see
the solution.

Thanx in advance for any help.

Markus


This is how to do it :
you create a file xyz containg:

select * from table
go

and the from OS prompt :
isql -U userid -P Password -S Server < xyz > xyz.out

Good Luck
Ali Ghandchi

Chittibabu Visweswaran

unread,
Apr 29, 1993, 12:31:58 PM4/29/93
to
In article <HACKES.93A...@leo.uni-paderborn.de>
hac...@uni-paderborn.de (Markus Brakweh) writes:
>
> I'm new in using Sybase (Version 4.2 on Sun OS 4.1.3) and I'm astonished
> not to find a way for saving isql-query results in a Unix-File.
>
Use this at your unix prompt.

>isql -Uusername -Ppassword <input file> outputfile

where input file - is the name of the file which has the sql statements.
output file - is the name of the file which has your query results.

-Vishu

Jeff King

unread,
Apr 29, 1993, 2:09:18 PM4/29/93
to
In <1993Apr29.1...@sequent.com> m...@sequent.com (Michael Perry) writes:

>In article <HACKES.93A...@leo.uni-paderborn.de> hac...@uni-paderborn.de (Markus Brakweh) writes:
>>
>>I'm new in using Sybase (Version 4.2 on Sun OS 4.1.3) and I'm astonished
>>not to find a way for saving isql-query results in a Unix-File.
>>
>>I didn't find something like 'select * from table into "filename.data"' in
>>the Manuals.
>>
>>That was possible in Unify 2000 and I'm sure that I am just to blind to see
>>the solution.
>>
>>Thanx in advance for any help.
>>
>>Markus

>Write your query in a file filename.sql and try this:

> isql -Uuser -Ppassword <filename.sql >results.out

>That should capture everything for you.

You can also use the -i flag in isql to take in filename.sql and then
pipe the results out to results.out the same way. Since I do this
quite regularly, I have created an alias called sqli which takes
a parameter (filename.sql) and then I pipe the results out from there.

(sqli filename.sql) > results.out

Jeff
--

Jeff King
gol...@panix.com

Matt Kosater

unread,
Apr 30, 1993, 4:55:34 PM4/30/93
to
In isql you may use the parameters "-i<input filename>" and "-o<output filename>".
This is documented in the DOS client but not in the unix docs.

example: isql -Usa -Ppswd -iinput.sql -ooutput.data

I have used this under SunOS and it works fine.
--
_____________________________________________________________________________
Matthew Kosater Email: ma...@meaddata.com
Strategic Data Systems Voice: 513-865-6800 x6622
-----------------------------------------------------------------------------

Robert Garvey

unread,
Apr 30, 1993, 6:17:16 PM4/30/93
to

I'd also recommend using the -n option which eliminates the "#>" prompts.
Also, the -e option to have input echoed onto output. The file will then
have both the queries and their results.

--
Robert Garvey rob...@sybase.com {sun,lll-tis,pyramid,pacbell}!sybase!robert
Sybase, Inc 6475 Christie Ave Emeryville, CA 94608-1010

Opinions may be attributed to poster, not necessarily related to Sybase.

Tsiel Ohayon

unread,
May 2, 1993, 10:51:27 PM5/2/93
to
In article <1rs3o6$i...@meaddata.meaddata.com> Matt Kosater writes:
[MK] In isql you may use the parameters "-i<input filename>" and
[MK] "-o<output filename>".
[MK] This is documented in the DOS client but not in the unix docs.

[MK] example: isql -Usa -Ppswd -iinput.sql -ooutput.data

Another way of doing is by using the redirection symbols.

isql -Usa -Ppswd < input > output

This works just as fine.

Tsiel
--
----8<--------------------------------------------------------------->8------
Tsiel:oha...@jcpl.co.jp | This message will autodestroy in 5 seconds
Employer may not have same | ___________________________________________|
opinions, if any ! ||____________________________________________()

Brent Lambert

unread,
May 12, 1993, 6:06:19 PM5/12/93
to
In article <3...@jcpltyo.JCPL.CO.JP>, oha...@jcpltyo.JCPL.CO.JP (Tsiel Ohayon) writes:
> In article <1rs3o6$i...@meaddata.meaddata.com> Matt Kosater writes:
> [MK] In isql you may use the parameters "-i<input filename>" and
> [MK] "-o<output filename>".
> [MK] This is documented in the DOS client but not in the unix docs.
>
> [MK] example: isql -Usa -Ppswd -iinput.sql -ooutput.data
>
> Another way of doing is by using the redirection symbols.
>
> isql -Usa -Ppswd < input > output
>
> This works just as fine.

And just in case we haven't beaten this thread to death . . .

If you don't want to mess with an input file, try:

$ isql -Ufoo -Pbar << EOF > output


> select * from table
> go

> EOF

The <<EOF says take input from the terminal until you get the string EOF.
Therefore, you could replace EOF with just about anything, if you want.
And you can even skip the string, just using "<< > output" and use ^D
(that's control-d) if you want to. I prefer EOF, myself.

--
The above statements are not the opinions or policies of SPSS Inc.
The above statements may not be the opinions of Brent Lambert.
The first disclaimer is a policy of SPSS Inc.
Subsequent disclaimers are probably the opinion of Brent Lambert.

divya...@gmail.com

unread,
Jan 22, 2015, 6:54:34 AM1/22/15
to
where should the .sql file be placed ?
0 new messages