Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

When using SQL Anywhere 12 ISQL with "Text" checked in Tools - Options - SQL Anywhere - Style, BINARY values can be truncated according to the length of the column name.

At first I thought this was expected behavior, but after being misled about a value, I no longer hold that opinion; 'tis a bug, not a feature :)

Rather than try to describe the rather funky "rules", the following example will demonstrate:

SELECT 0x30313233343536373839 AS a,
       a AS bbbbbbbbbbbbb,
       a AS cccccccccccccc,
       a AS ddddddddddddddddddddd, 
       a AS eeeeeeeeeeeeeeeeeeeeee, 
       a AS fffffffffffffffffffffffffff

a            bbbbbbbbbbbbb cccccccccccccc ddddddddddddddddddddd eeeeeeeeeeeeeeeeeeeeee fffffffffffffffffffffffffff 
------------ ------------- -------------- --------------------- ---------------------- --------------------------- 
0x3031323334 0x30313233343 0x303132333435 0x3031323334353637383 0x30313233343536373839 0x30313233343536373839      
(1 rows)
Execution time: 0.083 seconds

asked 09 Feb '13, 17:29

Breck%20Carter's gravatar image

Breck Carter
32.5k5417261050
accept rate: 20%

edited 09 Feb '13, 17:30


Thanks for the bug report - I have opened this issue internally for investigation as CR #731939. We will update this thread when we have a response.

permanent link

answered 11 Feb '13, 09:30

Jeff%20Albion's gravatar image

Jeff Albion
10.8k171175
accept rate: 25%

It looks like the algorithm for the output width is 2 for the 0x + sizeof(item). The size of the binary value is 10 bytes.

A work-around is to cast the hexadecimal string to a type twice as long (20 instead of default 10). Here's an example.

SELECT CAST( 0x30313233343536373839 as BINARY(20) ) AS a,
       a AS bbbbbbbbbbbbb,
       a AS cccccccccccccc,
       a AS ddddddddddddddddddddd,
       a AS eeeeeeeeeeeeeeeeeeeeee,
       a AS fffffffffffffffffffffffffff;
permanent link

answered 11 Feb '13, 14:20

JBSchueler's gravatar image

JBSchueler
3.3k41564
accept rate: 19%

edited 11 Feb '13, 14:55

CAST ( 0x30313233343536373839 AS BINARY ( 10 ) ) seems to make it work as well, so perhaps there's something deeper going on here :)

(11 Feb '13, 15:57) Breck Carter
Replies hidden

Running from the command line like this?

dbisql -c dba,sql read c:\temp\bin.sql

It doesn't for me. Perhaps it depends on the build.

(11 Feb '13, 16:05) JBSchueler

My mistake... ignore my comment.

(11 Feb '13, 17:29) Breck Carter
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×106

question asked: 09 Feb '13, 17:29

question was seen: 2,162 times

last updated: 11 Feb '13, 17:35