Multi-line SQL Query

Discuss RoboTask here
Post Reply
David W.
Posts: 41
Joined: Wed Feb 22, 2006 8:02 am

Multi-line SQL Query

Post by David W. »

Using Sybase SQL Anywhere and trying to do this in the SQL Query task:
 
select * from dba.HotelChain;
output to 'c:\\temp\\rb_chains.xls'
format Excel;
 
It works in my interactive SQL tool but gives error in RoboTask:
 
I: 2/22/2006 12:07:51 PM: Executing "SQL Query"
E: 2/22/2006 12:07:51 PM: Error occured: Syntax error or access violation: near 'output' in ...[output] to 'c:\\temp\\rb_
E: 2/22/2006 12:07:51 PM: An error occured. Step #0 (SQL Query).
E: 2/22/2006 12:07:51 PM: Task execution is aborted

Ideas?  Thanks.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Multi-line SQL Query

Post by Oleg »

Expression "output to 'c:\\temp\\rb_chains.xls' format Excel;" is not ANSI SQL expression. Maybe sybase client supports additional expressions.
For example "SQL Plus" (simple client for Oracle) supports additional non-SQL commands for formatting of results.
Last edited by Oleg on Wed Feb 22, 2006 12:20 pm, edited 1 time in total.
David W.
Posts: 41
Joined: Wed Feb 22, 2006 8:02 am

Multi-line SQL Query

Post by David W. »

Yes, you are correct.  So is there any way to execute this statement on the database?
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Multi-line SQL Query

Post by Oleg »

RoboTask execute SQL expressions via ADO - built-in engine of Windows. Thus, it supports ANSI SQL only.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Multi-line SQL Query

Post by Oleg »

Probably Sybase contain some utility, like SQL*Plus.
In this case you can execute complex expressions via command line.
David W.
Posts: 41
Joined: Wed Feb 22, 2006 8:02 am

Multi-line SQL Query

Post by David W. »

Yea, just wondered if I could stay within RoboTask...
 
We went that route.  The ISQL utility returns an errorlevel too so we can capture that and report on it.
 
The task turned out pretty nice.  About 5 statements in the entire script with some dates and output file names specified with computed variables.
 
Thanks for your help.
 
DW
Post Reply