The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

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
26.6k418575824
accept rate: 21%

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.7k171174
accept rate: 24%

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
1.9k2836
accept rate: 16%

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:

×101

question asked: 09 Feb '13, 17:29

question was seen: 898 times

last updated: 11 Feb '13, 17:35