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

x
?
Solved

"export to" command

Posted on 2006-03-23
7
Medium Priority
?
6,633 Views
Last Modified: 2010-10-05
hi,
 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
0
Comment
Question by:ramnram
  • 3
5 Comments
 
LVL 10

Accepted Solution

by:
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
go
select * from mytable
go
exit

You could also run something like this:

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

Author Comment

by:ramnram
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"
0
 
LVL 10

Expert Comment

by:bret
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?
0
 
LVL 10

Expert Comment

by:bret
ID: 16300148
"select @@version" will tell you.
0
 
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
0

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