Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Sybase - Print more than 512 K per output line to output - flat file

Posted on 2003-03-27
5
Medium Priority
?
415 Views
Last Modified: 2012-08-14
I want to procude a flat file, but receive errors when I try PRINT a single given line to the output file that is more than 512 bytes long.  I want to use just a single procedure if posible and not drop out to a unix shell script if it can be avoided.

I am not really use to Sybase, but more Oracle.  In Oracle I get around this constraint as follows: UTL_FILE.FOPEN(v_dir,v_file_out,'w',32767);

How can I can around the 512K limitation?  

Error is:

PRINT command failed because the resulting string exceeded the maximum length of 512 bytes.
(return status = -6)

Syntax is:

PRINT "%1!~%2!~%3!~%4!~%5!~%6!~%7!~%8!~%9!~%10!~%11!",
      @invoice_data1,
      @part_info,
      @tax_code,
      @inv_detail_totals1,
      @vendor_currency_id,
      @billto_no,
      @billto_info,
      @ship_to_info,
      @inv_detail_totals2,
      @gst_pst_tax_amts,
      @vat_amount

Thanks
Greg
0
Comment
Question by:DR_HIPPO
5 Comments
 
LVL 6

Expert Comment

by:DaniPro
ID: 8218254
If you use Adaptive Server Anywhere you can try to use the MESSAGE STATMENT
0
 

Author Comment

by:DR_HIPPO
ID: 8219395
Thanks for the comment -

We are running Adaptive Server Enterprise not the IQ - so this does not seem to work.
0
 
LVL 13

Expert Comment

by:alpmoon
ID: 8223043
In ASE 12.5 the limit is 1024 bytes. If you are not planning to upgrade ASE, I think you may consider to use select with convert function for numeric datatypes ( like select convert(char, @invoice_data1)+'~'+ @part_info + '~' + ..... )
0
 
LVL 9

Expert Comment

by:HamdyHassan
ID: 8226159
The following from sybase User Guide manual, about print
"
The maximum output string length of format_string plus all arguments
after substitution is 512 bytes."


I can help you with unix script if you want
0
 
LVL 9

Accepted Solution

by:
HamdyHassan earned 1500 total points
ID: 8226194
I get an crazy idea, instead of print, you insert into tempdb..mytemptable

then in your main script, you use sybase bcp out

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"Day by day nothing changes but when u look back, everything is different". That quote precisely describes today’s digital era. For example, you may not have noticed the change, but Voice Search is now all around us.
Google webmaster tool or Google search console is an imperative tool for solving different website relevant issues. The amazing features of this tool greatly help to check the indexing and improve the visibility of the site.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question