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.

About data type conversion

3 posts in General Discussion Last posting was on 2009-03-20 15:16:27.0Z
liangfei su Posted on 2009-03-19 08:53:17.0Z
From: liangfei su <suliangfei@gmail.com>
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
Subject: About data type conversion
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <49c207fd@forums-1-dub>
Date: 19 Mar 2009 00:53:17 -0800
X-Trace: forums-1-dub 1237452797 10.22.241.152 (19 Mar 2009 00:53:17 -0800)
X-Original-Trace: 19 Mar 2009 00:53:17 -0800, vip152.sybase.com
Lines: 19
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7414
Article PK: 5828

Hi, all

When i try some data type conversion example, i encounter this server
behavior:

select convert(varchar(5), 12345) -- conversion successful, return "12345"

select convert(varchar(5), 12345224252455656565) -- SQL error as excepted

select convert(varchar(10), 12345224252455656565) -- conversion
successfully, but a scientifical style integer presentation...


These sqls are executed in the same server with the same setting. Does
this an excepted server behavior? I think it's a little strange.


Thanks,
Liangfei Su


"Nick Elson [Sybase iAnywhere]" < Posted on 2009-03-20 14:41:17.0Z
From: "Nick Elson [Sybase iAnywhere]" <@nick@.@elson@@sybase@.@com@>
Newsgroups: ianywhere.public.general
References: <49c207fd@forums-1-dub>
Subject: Re: About data type conversion
Lines: 41
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <49c3ab0d$1@forums-1-dub>
Date: 20 Mar 2009 06:41:17 -0800
X-Trace: forums-1-dub 1237560077 10.22.241.152 (20 Mar 2009 06:41:17 -0800)
X-Original-Trace: 20 Mar 2009 06:41:17 -0800, vip152.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7419
Article PK: 5832

This is pretty much standard behaviour with and
it has been so since (at least) V6.

Since it cannot convert this, as an integer, to a string
of anything less than the number of significant integral
digits it will attempt to convert it through a double.
Implicit conversion to double will only succeed,
though, if there is room for 9 or more characters;
required to store a string of this format

[-]{1-9}.{0-9}{0-9}E[-]{0-9}{0-9}
or
1, 2, 3, 4, 5, 6,7, 8, 9 characters

as a via general purpose numeric format.

"liangfei su" <suliangfei@gmail.com> wrote in message
news:49c207fd@forums-1-dub...
> Hi, all
>
> When i try some data type conversion example, i encounter this server
> behavior:
>
> select convert(varchar(5), 12345) -- conversion successful, return "12345"
>
> select convert(varchar(5), 12345224252455656565) -- SQL error as excepted
>
> select convert(varchar(10), 12345224252455656565) -- conversion
> successfully, but a scientifical style integer presentation...
>
>
> These sqls are executed in the same server with the same setting. Does
> this an excepted server behavior? I think it's a little strange.
>
>
> Thanks,
> Liangfei Su


Glenn Paulley [Sybase iAnywhere] Posted on 2009-03-20 15:16:27.0Z
From: "Glenn Paulley [Sybase iAnywhere]" <paulley@ianywhere.com>
Reply-To: paulley@ianywhere.com
Organization: Sybase iAnywhere
User-Agent: Thunderbird 2.0.0.21 (Windows/20090302)
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
Subject: Re: About data type conversion
References: <49c207fd@forums-1-dub>
In-Reply-To: <49c207fd@forums-1-dub>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <49c3b34b@forums-1-dub>
Date: 20 Mar 2009 07:16:27 -0800
X-Trace: forums-1-dub 1237562187 10.22.241.152 (20 Mar 2009 07:16:27 -0800)
X-Original-Trace: 20 Mar 2009 07:16:27 -0800, vip152.sybase.com
Lines: 45
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7421
Article PK: 5834

The following whitepaper may be useful:

http://www.sybase.com/detail?id=1027471

Glenn

liangfei su wrote:
> Hi, all
>
> When i try some data type conversion example, i encounter this server
> behavior:
>
> select convert(varchar(5), 12345) -- conversion successful, return "12345"
>
> select convert(varchar(5), 12345224252455656565) -- SQL error as excepted
>
> select convert(varchar(10), 12345224252455656565) -- conversion
> successfully, but a scientifical style integer presentation...
>
>
> These sqls are executed in the same server with the same setting. Does
> this an excepted server behavior? I think it's a little strange.
>
>
> Thanks,
> Liangfei Su

--
Glenn Paulley
Director, Engineering (Query Processing)
Sybase iAnywhere

Blog: http://iablog.sybase.com/paulley

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

To Submit Bug Reports: http://case-express.sybase.com

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
Sybase iAnywhere pages at
http://www.sybase.com/products/databasemanagement/sqlanywhere/technicalsupport