Link to home
Create AccountLog in
Avatar of ramnram
ramnram

asked on

"export to" command

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
ASKER CERTIFIED SOLUTION
Avatar of bret
bret
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of ramnram
ramnram

ASKER

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"
What do you mean by "Sybase 11.9"?  Sybase is the name of the company, not the product.
Are you using ASE or ASA?
"select @@version" will tell you.
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