| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

03-19-11, 22:14
|
|
Registered User
|
|
Join Date: Mar 2011
Posts: 6
|
|
|
exporting data to cvs in sybase
|
|
hello all!
quick version,,, I am running Servoy 3.5.12 , sybase asa v 10.1 on centos v 5.5.
I need to run a nightly routine getting data from one table ( 5 - 10 fields) and exporting to csv file. Was told I could not schedule an event that uses OUTPUT command. I can run from interactive sql, but then would have to do it each day.
Tried to run command dbisql -c "DSN = mydatabase" my_daily_script.sql but this errors not finding libdblib10_r.so.
All I need to do is create a text file with data to import into a db used for a phone dialer to remind clients of appts.
I'm stumped.
Any help will be greatly appreciated
|
|

03-19-11, 23:14
|
|
Registered User
|
|
Join Date: Mar 2011
Posts: 6
|
|
|
comamnd line to topic?
Have found a possible solution,, but not getting it to work............
here is what i am typing:
[stevek@homeserver scripts]$ /srv/sqlanywhere10/bin32/dbisql -nogui -U DBA -S sql -S servoy_repository -i /home/stevek/Desktop/phone_dialer.sql
and here is the result:
Usage: DBISQL [options] [sqlCommand|commandFileName]
@<data> expands <data> from file <data>
So,,,,,,,,,,,,,,
Am I completely wrong in trying to get a csv file from comamndline? or,,, am I jsut not entering it corrrectly?
Thanks for any help
|
|

03-22-11, 08:56
|
|
Registered User
|
|
Join Date: May 2005
Location: South Africa
Posts: 1,268
|
|
|
|

03-22-11, 16:15
|
|
Registered User
|
|
Join Date: Mar 2011
Posts: 6
|
|
|
use of bcp?
reading about bcp, it appears it is used for a whole table.
I need to do the following in an automated schedule:
SELECT phone_home_client, creationdate, dateformat(creationdate, 'mm/dd/yy'), appt_time, staff_email
FROM outcomes WHERE specifier1 = 'Next TASC Appointment';
OUTPUT TO '/home/stevek/Desktop/test2day.csv'
|
|

03-23-11, 04:00
|
|
Registered User
|
|
Join Date: Jan 2004
Location: The Hague/Utrecht, NL
Posts: 415
|
|
You can create a view with that specifiek selectstatement, and bcp-out the view to '/home/stevek/Desktop/test2day.csv
BCP works with both tables and views.
__________________
I'm not crazy, I'm an aeroplane!
|
|

03-23-11, 04:02
|
|
Registered User
|
|
Join Date: May 2005
Location: South Africa
Posts: 1,268
|
|
Options available:
1) use the init string of bcp to do the select
2) Create a view and bcp out the view
3) select into a tempdb table, bcp out the tempdb table, drop the temp table
|
|

03-23-11, 04:21
|
|
Registered User
|
|
Join Date: May 2005
Location: South Africa
Posts: 1,268
|
|
example using --initstring
Code:
bcp tempdb..#t1 out /tmp/mydata.csv -c -Ume -Pmypw -Smysrv --initstring "select currdate=convert(char(8),getdate(),1) into #t1"
Starting copy...
1 rows copied.
Clock Time (ms.): total = 2 Avg = 2 (500.00 rows per sec.)
|
|

03-30-11, 15:31
|
|
Registered User
|
|
Join Date: Mar 2011
Posts: 6
|
|
|
bcp error
Thanks for the suggestions. However, it errors.
Here is a screenshot:
|
|

03-31-11, 03:27
|
|
Registered User
|
|
Join Date: May 2005
Location: South Africa
Posts: 1,268
|
|
bcp is not a sql command. You need to run it from the operating system command prompt
|
|

04-03-11, 18:38
|
|
Registered User
|
|
Join Date: Mar 2011
Posts: 6
|
|
|
exporting to cvs in sybase
Hello all!
Thanks so much for the help!
I found the answer. I can schedule a script to export data in sybase by using the UNLOAD command.
it worked great.
Again, thanks for all the suggestions
|
|

04-05-11, 05:12
|
|
Registered User
|
|
Join Date: May 2005
Location: South Africa
Posts: 1,268
|
|
There is no unload command in Sybase ASE
Only noticed now you are using Sybase sqlanywhere10
Thanks for posting your solution
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|