vishali_vishu
asked on
pull data from sybase
I have a query in sybase (sql) and i want to pull the data from that sql to a flat file using a shell script.
Just as we use sqlplus to pull oracle data and spool it to a file.
How to do this?
Just as we use sqlplus to pull oracle data and spool it to a file.
How to do this?
I'm not as familiar with Sybase as with Oracle, but I do use dbisql just a bit, here is what I know
I have a script tables.sql to list the tables in my Sybase database
--tables.sql:
select * from sysobjects where type = 'U'
I have a script tables.sql to list the tables in my Sybase database
--tables.sql:
select * from sysobjects where type = 'U'
dbisql -c "UID=dba;PWD=sql" tables.sql > results.txt
ASKER
is it possible to pull to pull few columns from a table (sybase table).
ex: Table_x (col_1,col_2,col_3,col_4,c ol_5).
can i use the bcp to pull only col_2 and col_5 ?
ex: Table_x (col_1,col_2,col_3,col_4,c
can i use the bcp to pull only col_2 and col_5 ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
By the way, if you want a quicker solution without more flexilbility, creating a view including only these columns would be easier.
isql lets you run any query or procedure, but output will contain some clutter (names of columns, horizontal dividing lines, number of returned records etc)
bcp cen give you clear data, but you can output only tables or views (so you have to store your query as a view and then you can use bcp).
See http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.utility/html/utility/title.htm for detailed explanation of both these utilities.