[Webinar] Learn how to a build a cloud-first strategyRegister Now


"export to" command

Posted on 2006-03-23
Medium Priority
Last Modified: 2010-10-05
 i want to export data from a table to a flat file. I want to do this operation from my stored procedure after doing some manipulations with the table. I know there is a comman "export to" in isql. i am using sybase 11.9. i want syntax for this with example
Question by:ramnram
  • 3
LVL 10

Accepted Solution

bret earned 200 total points
ID: 16285731
ISQL itself does not have an "export to" command.  

Sybase Adaptive Server Anywhere does have such a command, though - if you
are using ISQL against ASA, you can execute that command - but it is ASA doing
it, not ISQL

select * from employee where 1=0;
output to 'c:\test.xls' format excel;

You can, however, direct output to a file with isql using the -o parameter.

isql -Usa -P -o myfilename
use mydatabase
select * from mytable

You could also run something like this:

execute xp_cmdshell "bcp mydatabase.owner.name out myfilename -Usa -P  -c"

Author Comment

ID: 16298632
This is not working for me.I am using Sybase 11.9.

Error i am getting is:
Line 2:
Incorrect syntax near the keyword 'to'.

Also tell me "where should i give this command"
LVL 10

Expert Comment

ID: 16300133
What do you mean by "Sybase 11.9"?  Sybase is the name of the company, not the product.
Are you using ASE or ASA?
LVL 10

Expert Comment

ID: 16300148
"select @@version" will tell you.
LVL 14

Expert Comment

by:Jan Franek
ID: 16331146
11.9 is for sure ASE not ASA

You may try the last solution that bret mentioned:

execute xp_cmdshell "bcp mydatabase.owner.name out myfilename -Usa -P  -c"

But be aware, that output file will be created on server machine, not on client.

By redirecting isql output you will get some formating stuff in your output file, so it will need some polishing, but this way you get output file on client machine

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If anyone asked you to network diagram of the internet, it was drawn in the form of a fluffy cloud which further became known as cloud computing. Popularly cloud computing is defined as workloads that run over the internet in a commercial provider’s…
Most folks would know the basics of how Dropbox works, so that’s not the purpose of this article. Security is what it’s all about, so here I’ll share how I choose to secure my Dropbox Account and the Data it contains.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question