Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

OUTPUT TO Failing within compound statement block.

4 posts in General Discussion Last posting was on 2003-10-30 22:13:03.0Z
Doug2 Posted on 2003-10-30 20:12:57.0Z
Sender: 1475.3fa17bbf.1804289383@sybase.com
From: Doug2
Newsgroups: ianywhere.public.general
Subject: OUTPUT TO Failing within compound statement block.
X-Mailer: WebNews to Mail Gateway v1.1s
Message-ID: <3fa17ff0.14af.846930886@sybase.com>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 30 Oct 2003 13:17:36 -0700, 10.22.241.42
Lines: 19
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 30 Oct 2003 13:05:11 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 30 Oct 2003 13:12:57 -0700
X-Trace: forums-1-dub 1067548377 10.22.108.75 (30 Oct 2003 13:12:57 -0700)
X-Original-Trace: 30 Oct 2003 13:12:57 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1974
Article PK: 4217

I can't determine why output to won't write a file when
within Begin / End. The example doesn't show it, but I'm
trying to write table values & constants to the same output
file.

Is there another way to create a fixed-fieldlength file?

As shown, the first block receives the error "Could not
execute statement. Lexical error at line 5 column 16.
Encountered: "\\" (92) after: "". If I add any manner of
quotes or double slashes, I get a syntax error msg box with
"ASA Error 131 - Syntax error near 'OUTPUT' on line"

begin
select 'end';
OUTPUT TO C:\temp\tstout.txt format fixed;
end

Without Begin/End it works fine.


Breck Carter [TeamSybase] Posted on 2003-10-30 22:13:03.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: OUTPUT TO Failing within compound statement block.
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <e463qvg2607882of4n04b39hlubh1sfvbs@4ax.com>
References: <3fa17ff0.14af.846930886@sybase.com>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: bcarter.sentex.ca
X-Original-NNTP-Posting-Host: bcarter.sentex.ca
Date: 30 Oct 2003 15:13:03 -0700
X-Trace: forums-1-dub 1067555583 64.7.134.118 (30 Oct 2003 15:13:03 -0700)
X-Original-Trace: 30 Oct 2003 15:13:03 -0700, bcarter.sentex.ca
Lines: 35
X-Authenticated-User: TeamPS
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1977
Article PK: 17344

Everything within a BEGIN END is sent to the server to be executed,
and the server don't know 'nuthin 'bout no "OUTPUT" statement :)...
this is a point that confuses *everyone*, sometimes for *years* (like
me).

Breck

On 30 Oct 2003 13:12:57 -0700, Doug2 wrote:

>I can't determine why output to won't write a file when
>within Begin / End. The example doesn't show it, but I'm
>trying to write table values & constants to the same output
>file.
>
>Is there another way to create a fixed-fieldlength file?
>
>As shown, the first block receives the error "Could not
>execute statement. Lexical error at line 5 column 16.
>Encountered: "\\" (92) after: "". If I add any manner of
>quotes or double slashes, I get a syntax error msg box with
>"ASA Error 131 - Syntax error near 'OUTPUT' on line"
>
>begin
> select 'end';
> OUTPUT TO C:\temp\tstout.txt format fixed;
>end
>
>Without Begin/End it works fine.

--
bcarter@risingroad.com
Mobile and Distributed Enterprise Database Applications
www.risingroad.com


"Bruce Hay" Posted on 2003-10-30 21:59:26.0Z
From: "Bruce Hay" <hay at sybase dot com>
Newsgroups: ianywhere.public.general
References: <3fa17ff0.14af.846930886@sybase.com>
Subject: Re: OUTPUT TO Failing within compound statement block.
Lines: 33
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
X-Original-NNTP-Posting-Host: hay-xp.sybase.com
Message-ID: <3fa198ea$1@forums-2-dub>
X-Original-Trace: 30 Oct 2003 15:04:10 -0700, hay-xp.sybase.com
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 30 Oct 2003 14:51:43 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 30 Oct 2003 14:59:26 -0700
X-Trace: forums-1-dub 1067554766 10.22.108.75 (30 Oct 2003 14:59:26 -0700)
X-Original-Trace: 30 Oct 2003 14:59:26 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1976
Article PK: 17411

Use the UNLOAD statement with the STRING() function to concatenate the
values (or use ||) and the QUOTES OFF option to eliminate quotes.

begin
unload select string('end ',current timestamp)
to 'c:\temp\tstout.txt' quotes off;
end

Whitepapers, TechDocs, bug fixes are all available through the iAnywhere
Developer Community at http://www.ianywhere.com/developer

<Doug2> wrote in message news:3fa17ff0.14af.846930886@sybase.com...
> I can't determine why output to won't write a file when
> within Begin / End. The example doesn't show it, but I'm
> trying to write table values & constants to the same output
> file.
>
> Is there another way to create a fixed-fieldlength file?
>
> As shown, the first block receives the error "Could not
> execute statement. Lexical error at line 5 column 16.
> Encountered: "\\" (92) after: "". If I add any manner of
> quotes or double slashes, I get a syntax error msg box with
> "ASA Error 131 - Syntax error near 'OUTPUT' on line"
>
> begin
> select 'end';
> OUTPUT TO C:\temp\tstout.txt format fixed;
> end
>
> Without Begin/End it works fine.


Glenn Paulley Posted on 2003-10-30 20:33:59.0Z
From: Glenn Paulley <paulley@ianywhere.com>
Reply-To: paulley@ianywhere.com
Organization: iAnywhere Solutions
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2.1) Gecko/20021130
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
Subject: Re: OUTPUT TO Failing within compound statement block.
References: <3fa17ff0.14af.846930886@sybase.com>
In-Reply-To: <3fa17ff0.14af.846930886@sybase.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: paulley-xp.sybase.com
X-Original-NNTP-Posting-Host: paulley-xp.sybase.com
Message-ID: <3fa183c7$1@forums-1-dub>
Date: 30 Oct 2003 13:33:59 -0700
X-Trace: forums-1-dub 1067549639 172.31.142.134 (30 Oct 2003 13:33:59 -0700)
X-Original-Trace: 30 Oct 2003 13:33:59 -0700, paulley-xp.sybase.com
Lines: 42
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1975
Article PK: 31457

OUTPUT is a DBISQL command, not a SQL statement, so you can't use OUTPUT
within a stored procedure.

Glenn

Doug2 wrote:
> I can't determine why output to won't write a file when
> within Begin / End. The example doesn't show it, but I'm
> trying to write table values & constants to the same output
> file.
>
> Is there another way to create a fixed-fieldlength file?
>
> As shown, the first block receives the error "Could not
> execute statement. Lexical error at line 5 column 16.
> Encountered: "\\" (92) after: "". If I add any manner of
> quotes or double slashes, I get a syntax error msg box with
> "ASA Error 131 - Syntax error near 'OUTPUT' on line"
>
> begin
> select 'end';
> OUTPUT TO C:\temp\tstout.txt format fixed;
> end
>
> Without Begin/End it works fine.

--
Glenn Paulley
Research and Development Manager, Query Processing
iAnywhere Solutions Engineering

EBF's and Patches: http://downloads.sybase.com
choose SQL Anywhere Studio >> change 'time frame' to all

To Submit Bug Reports: http://casexpress.sybase.com/cx/cx.stm

SQL Anywhere Studio Supported Platforms and Support Status
http://my.sybase.com/detail?id=1002288

Whitepapers, TechDocs, and bug fixes are all available through the iAnywhere
Developer Community at www.ianywhere.com/developer