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.

Numeric Datatype

9 posts in General Discussion Last posting was on 2009-10-20 11:15:54.0Z
Harsha Posted on 2009-10-16 20:22:00.0Z
Sender: 34fa.4ad8d171.1804289383@sybase.com
From: Harsha
Newsgroups: sybase.public.ase.general
Subject: Numeric Datatype
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4ad8d5e8.3561.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 16 Oct 2009 13:22:00 -0700
X-Trace: forums-1-dub 1255724520 10.22.241.41 (16 Oct 2009 13:22:00 -0700)
X-Original-Trace: 16 Oct 2009 13:22:00 -0700, 10.22.241.41
Lines: 29
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28493
Article PK: 77734

Hi,

If I create a numeric variable up to 16 precision with 0
scale and tries to enter value up to 16 digit long number it
works fine.

DECLARE @hid NUMERIC(16, 0)
SET @hid = 1234567890123456
SELECT @hid

But when I creates the numeric variable with precision above
17 and assigns it the value of 17 digit long number. While
selecting the value it returns the number up to 16 digit
correctly but for the last digit if it's odd value it
returns me the one number less than that i.e. if last digit
is 7 it returns me the value 6 and if it's even number it
returns me the correct value. Here is the example.

DECLARE @hid NUMERIC(17, 0)
SET @hid = 12345678901234567
SELECT @hid

select gives me the value 12345678901234566 whereas it
should be 12345678901234567.

Can anyone shed some light on this.

Thanks,
Harsha


"Mark A. Parsons" <iron_horse Posted on 2009-10-16 20:58:25.0Z
From: "Mark A. Parsons" <iron_horse@no_spamola.compuserve.com>
User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
Subject: Re: Numeric Datatype
References: <4ad8d5e8.3561.1681692777@sybase.com>
In-Reply-To: <4ad8d5e8.3561.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 091014-0, 10/14/2009), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4ad8de71$1@forums-1-dub>
Date: 16 Oct 2009 13:58:25 -0700
X-Trace: forums-1-dub 1255726705 10.22.241.152 (16 Oct 2009 13:58:25 -0700)
X-Original-Trace: 16 Oct 2009 13:58:25 -0700, vip152.sybase.com
Lines: 52
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28494
Article PK: 77736

What is your ASE version?

------------------

On my 15.0.3 dataserver I get the expected result:


1> select @@version
2> go

----------------------------------------------------------------------------------------------------------------------
Adaptive Server Enterprise/15.0.3/EBF 16738 ESD#2/P/NT (IX86)/Windows 2003/ase1503/2708/32-bit/OPT/Mon Jul 27 20:19:56

1> DECLARE @hid NUMERIC(17, 0)
2> SET @hid = 12345678901234567
3> SELECT @hid
4> go

--------------------
12345678901234567

Harsha wrote:
> Hi,
>
> If I create a numeric variable up to 16 precision with 0
> scale and tries to enter value up to 16 digit long number it
> works fine.
>
> DECLARE @hid NUMERIC(16, 0)
> SET @hid = 1234567890123456
> SELECT @hid
>
> But when I creates the numeric variable with precision above
> 17 and assigns it the value of 17 digit long number. While
> selecting the value it returns the number up to 16 digit
> correctly but for the last digit if it's odd value it
> returns me the one number less than that i.e. if last digit
> is 7 it returns me the value 6 and if it's even number it
> returns me the correct value. Here is the example.
>
> DECLARE @hid NUMERIC(17, 0)
> SET @hid = 12345678901234567
> SELECT @hid
>
> select gives me the value 12345678901234566 whereas it
> should be 12345678901234567.
>
> Can anyone shed some light on this.
>
> Thanks,
> Harsha


Harsha Posted on 2009-10-16 21:01:43.0Z
Sender: 34fa.4ad8d171.1804289383@sybase.com
From: Harsha
Newsgroups: sybase.public.ase.general
Subject: Re: Numeric Datatype
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4ad8df37.3646.1681692777@sybase.com>
References: <4ad8de71$1@forums-1-dub>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 16 Oct 2009 14:01:43 -0700
X-Trace: forums-1-dub 1255726903 10.22.241.41 (16 Oct 2009 14:01:43 -0700)
X-Original-Trace: 16 Oct 2009 14:01:43 -0700, 10.22.241.41
Lines: 64
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28495
Article PK: 77737

I'm using the v12.5.4. Is that the issue?

SELECT @@version
go

Adaptive Server Enterprise/12.5.4/EBF 14919
ESD#7/P/Sun_svr4/OS 5.8/ase1254/2093/64-bit/FBO/Thu Oct 11
09:25:36 2007

> What is your ASE version?
>
> ------------------
>
> On my 15.0.3 dataserver I get the expected result:
>
>
> 1> select @@version
> 2> go
>
> ----------------------------------------------------------
> ----------------------------------------------------------
> -- Adaptive Server Enterprise/15.0.3/EBF 16738 ESD#2/P/NT
> (IX86)/Windows 2003/ase1503/2708/32-bit/OPT/Mon Jul 27
> 20:19:56
>
> 1> DECLARE @hid NUMERIC(17, 0)
> 2> SET @hid = 12345678901234567
> 3> SELECT @hid
> 4> go
>
> --------------------
> 12345678901234567
>
>
> Harsha wrote:
> > Hi,
> >
> > If I create a numeric variable up to 16 precision with 0
> > scale and tries to enter value up to 16 digit long
> > number it works fine.
> >
> > DECLARE @hid NUMERIC(16, 0)
> > SET @hid = 1234567890123456
> > SELECT @hid
> >
> > But when I creates the numeric variable with precision
> > above 17 and assigns it the value of 17 digit long
> > number. While selecting the value it returns the number
> > up to 16 digit correctly but for the last digit if it's
> > odd value it returns me the one number less than that
> > i.e. if last digit is 7 it returns me the value 6 and
> > if it's even number it returns me the correct value.
> > Here is the example.
> > DECLARE @hid NUMERIC(17, 0)
> > SET @hid = 12345678901234567
> > SELECT @hid
> >
> > select gives me the value 12345678901234566 whereas it
> > should be 12345678901234567.
> >
> > Can anyone shed some light on this.
> >
> > Thanks,
> > Harsha


"Mark A. Parsons" <iron_horse Posted on 2009-10-16 21:33:58.0Z
From: "Mark A. Parsons" <iron_horse@no_spamola.compuserve.com>
User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
Subject: Re: Numeric Datatype
References: <4ad8de71$1@forums-1-dub> <4ad8df37.3646.1681692777@sybase.com>
In-Reply-To: <4ad8df37.3646.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 091014-0, 10/14/2009), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4ad8e6c6$1@forums-1-dub>
Date: 16 Oct 2009 14:33:58 -0700
X-Trace: forums-1-dub 1255728838 10.22.241.152 (16 Oct 2009 14:33:58 -0700)
X-Original-Trace: 16 Oct 2009 14:33:58 -0700, vip152.sybase.com
Lines: 72
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28496
Article PK: 77738

I don't currently have access to a 12.5.4 dataserver so I can't confirm/deny an issue with 12.5.4 (ESD#2).

Unless someone posts back here with confirmation of an issue with your version of ASE ... you'll probably have to
contact Sybase TechSupport for assistance.

Are you running your tests via the command line isql tool? or are you using some other front-end tool/application?

Harsha wrote:
> I'm using the v12.5.4. Is that the issue?
>
> SELECT @@version
> go
>
> Adaptive Server Enterprise/12.5.4/EBF 14919
> ESD#7/P/Sun_svr4/OS 5.8/ase1254/2093/64-bit/FBO/Thu Oct 11
> 09:25:36 2007
>
>> What is your ASE version?
>>
>> ------------------
>>
>> On my 15.0.3 dataserver I get the expected result:
>>
>>
>> 1> select @@version
>> 2> go
>>
>> ----------------------------------------------------------
>> ----------------------------------------------------------
>> -- Adaptive Server Enterprise/15.0.3/EBF 16738 ESD#2/P/NT
>> (IX86)/Windows 2003/ase1503/2708/32-bit/OPT/Mon Jul 27
>> 20:19:56
>>
>> 1> DECLARE @hid NUMERIC(17, 0)
>> 2> SET @hid = 12345678901234567
>> 3> SELECT @hid
>> 4> go
>>
>> --------------------
>> 12345678901234567
>>
>>
>> Harsha wrote:
>>> Hi,
>>>
>>> If I create a numeric variable up to 16 precision with 0
>>> scale and tries to enter value up to 16 digit long
>>> number it works fine.
>>>
>>> DECLARE @hid NUMERIC(16, 0)
>>> SET @hid = 1234567890123456
>>> SELECT @hid
>>>
>>> But when I creates the numeric variable with precision
>>> above 17 and assigns it the value of 17 digit long
>>> number. While selecting the value it returns the number
>>> up to 16 digit correctly but for the last digit if it's
>>> odd value it returns me the one number less than that
>>> i.e. if last digit is 7 it returns me the value 6 and
>>> if it's even number it returns me the correct value.
>>> Here is the example.
>>> DECLARE @hid NUMERIC(17, 0)
>>> SET @hid = 12345678901234567
>>> SELECT @hid
>>>
>>> select gives me the value 12345678901234566 whereas it
>>> should be 12345678901234567.
>>>
>>> Can anyone shed some light on this.
>>>
>>> Thanks,
>>> Harsha


Rob V [ Sybase ] Posted on 2009-10-17 15:30:58.0Z
Reply-To: "Rob V [ Sybase ]" <robv@DO.NOT.SPAM.sypron.nl.REMOVE.THIS.DECOY>
From: "Rob V [ Sybase ]" <robv@DO.NOT.SPAM.sypron.nl.REMOVE.THIS.DECOY>
Newsgroups: sybase.public.ase.general
References: <4ad8de71$1@forums-1-dub> <4ad8df37.3646.1681692777@sybase.com> <4ad8e6c6$1@forums-1-dub>
Subject: Re: Numeric Datatype
Lines: 9
Organization: Sypron BV / TeamSybase / Sybase
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4ad9e332@forums-1-dub>
Date: 17 Oct 2009 08:30:58 -0700
X-Trace: forums-1-dub 1255793458 10.22.241.152 (17 Oct 2009 08:30:58 -0700)
X-Original-Trace: 17 Oct 2009 08:30:58 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28499
Article PK: 77741

Works fine for me on 12.5.4 esd#9:

1> select @@version
2> go

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Adaptive Server Enterprise/12.5.4/EBF 16135 ESD#9/P/Linux Intel/EnterpriseLinux/ase1254/2143/32-bit/OPT/Wed Feb 4 05:55:50 2009(1 row affected)1> DECLARE @hid NUMERIC(17, 0)2> SET @hid = 123456789012345673> SELECT @hid4> go(1 row affected) -------------------- 12345678901234567(1 row affected)Rob V."Mark A. Parsons" <iron_horse@no_spamola.compuserve.com> wrote in messagenews:4ad8e6c6$1@forums-1-dub...>I don't currently have access to a 12.5.4 dataserver so I can'tconfirm/deny an issue with 12.5.4 (ESD#2).>> Unless someone posts back here with confirmation of an issue with yourversion of ASE ... you'll probably have to contact Sybase TechSupport forassistance.>> Are you running your tests via the command line isql tool? or are youusing some other front-end tool/application?>> Harsha wrote:>> I'm using the v12.5.4. Is that the issue?>>>> SELECT @@version>> go>>>> Adaptive Server Enterprise/12.5.4/EBF 14919>> ESD#7/P/Sun_svr4/OS 5.8/ase1254/2093/64-bit/FBO/Thu Oct 11>> 09:25:36 2007>>>>> What is your ASE version?>>>>>> ------------------>>>>>> On my 15.0.3 dataserver I get the expected result:>>>>>>>>> 1> select @@version>>> 2> go>>>>>> ---------------------------------------------------------->>> ---------------------------------------------------------->>> -- Adaptive Server Enterprise/15.0.3/EBF 16738 ESD#2/P/NT>>> (IX86)/Windows 2003/ase1503/2708/32-bit/OPT/Mon Jul 27>>> 20:19:56>>>>>> 1> DECLARE @hid NUMERIC(17, 0)>>> 2> SET @hid = 12345678901234567>>> 3> SELECT @hid>>> 4> go>>>>>> -------------------->>> 12345678901234567>>>>>>>>> Harsha wrote:>>>> Hi,>>>>>>>> If I create a numeric variable up to 16 precision with 0>>>> scale and tries to enter value up to 16 digit long>>>> number it works fine.>>>>>>>> DECLARE @hid NUMERIC(16, 0)>>>> SET @hid = 1234567890123456>>>> SELECT @hid>>>>>>>> But when I creates the numeric variable with precision>>>> above 17 and assigns it the value of 17 digit long>>>> number. While selecting the value it returns the number>>>> up to 16 digit correctly but for the last digit if it's>>>> odd value it returns me the one number less than that>>>> i.e. if last digit is 7 it returns me the value 6 and>>>> if it's even number it returns me the correct value.>>>> Here is the example.>>>> DECLARE @hid NUMERIC(17, 0)>>>> SET @hid = 12345678901234567>>>> SELECT @hid>>>>>>>> select gives me the value 12345678901234566 whereas it>>>> should be 12345678901234567.>>>>>>>> Can anyone shed some light on this.>>>>>>>> Thanks,>>>> Harsha


Michael Peppler [Team Sybase] Posted on 2009-10-17 15:17:31.0Z
From: "Michael Peppler [Team Sybase]" <mpeppler@peppler.org>
Organization: Peppler Consulting SARL
Subject: Re: Numeric Datatype
User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.)
Message-ID: <pan.2009.10.17.15.17.28.452341@peppler.org>
Newsgroups: sybase.public.ase.general
References: <4ad8d5e8.3561.1681692777@sybase.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 17 Oct 2009 08:17:31 -0700
X-Trace: forums-1-dub 1255792651 10.22.241.152 (17 Oct 2009 08:17:31 -0700)
X-Original-Trace: 17 Oct 2009 08:17:31 -0700, vip152.sybase.com
Lines: 54
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28498
Article PK: 77740

That works for me as well:

[45] SYBASE.bugdb.1> DECLARE @hid NUMERIC(17, 0)
[45] SYBASE.bugdb.2> SET @hid = 12345678901234567
[45] SYBASE.bugdb.3> SELECT @hid
[45] SYBASE.bugdb.4> go
(1 row affected)

--------------------
12345678901234567

(1 row affected)

That's on a 12.5.3 server.

What tool are you using?

It is possible that your tool is converting the large numeric() data to
float, and float has a 15 digit precision limit, if I recall correctly.

Michael

On Fri, 16 Oct 2009 13:22:00 -0700, Harsha wrote:

> Hi,
>
> If I create a numeric variable up to 16 precision with 0
> scale and tries to enter value up to 16 digit long number it
> works fine.
>
> DECLARE @hid NUMERIC(16, 0)
> SET @hid = 1234567890123456
> SELECT @hid
>
> But when I creates the numeric variable with precision above
> 17 and assigns it the value of 17 digit long number. While
> selecting the value it returns the number up to 16 digit
> correctly but for the last digit if it's odd value it
> returns me the one number less than that i.e. if last digit
> is 7 it returns me the value 6 and if it's even number it
> returns me the correct value. Here is the example.
>
> DECLARE @hid NUMERIC(17, 0)
> SET @hid = 12345678901234567
> SELECT @hid
>
> select gives me the value 12345678901234566 whereas it
> should be 12345678901234567.
>
> Can anyone shed some light on this.
>
> Thanks,
> Harsha


Harsha Posted on 2009-10-19 14:36:27.0Z
Sender: 7c29.4adc71ce.1804289383@sybase.com
From: Harsha
Newsgroups: sybase.public.ase.general
Subject: Re: Numeric Datatype
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4adc796b.7dae.1681692777@sybase.com>
References: <pan.2009.10.17.15.17.28.452341@peppler.org>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 19 Oct 2009 07:36:27 -0700
X-Trace: forums-1-dub 1255962987 10.22.241.41 (19 Oct 2009 07:36:27 -0700)
X-Original-Trace: 19 Oct 2009 07:36:27 -0700, 10.22.241.41
Lines: 60
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28503
Article PK: 77746

Thanks for your help. I'm using SqlDbx v3.11 (Professional
Edition) tool as a SQL Developer IDE. It can be because of
that tool as even if I connect to SQL Server using that tool
it gives me the same wrong number.

> That works for me as well:
>
> [45] SYBASE.bugdb.1> DECLARE @hid NUMERIC(17, 0)
> [45] SYBASE.bugdb.2> SET @hid = 12345678901234567
> [45] SYBASE.bugdb.3> SELECT @hid
> [45] SYBASE.bugdb.4> go
> (1 row affected)
>
> --------------------
> 12345678901234567
>
> (1 row affected)
>
> That's on a 12.5.3 server.
>
> What tool are you using?
>
> It is possible that your tool is converting the large
> numeric() data to float, and float has a 15 digit
> precision limit, if I recall correctly.
>
> Michael
>
> On Fri, 16 Oct 2009 13:22:00 -0700, Harsha wrote:
>
> > Hi,
> >
> > If I create a numeric variable up to 16 precision with 0
> > scale and tries to enter value up to 16 digit long
> > number it works fine.
> >
> > DECLARE @hid NUMERIC(16, 0)
> > SET @hid = 1234567890123456
> > SELECT @hid
> >
> > But when I creates the numeric variable with precision
> > above 17 and assigns it the value of 17 digit long
> > number. While selecting the value it returns the number
> > up to 16 digit correctly but for the last digit if it's
> > odd value it returns me the one number less than that
> > i.e. if last digit is 7 it returns me the value 6 and
> > if it's even number it returns me the correct value.
> > Here is the example.
> > DECLARE @hid NUMERIC(17, 0)
> > SET @hid = 12345678901234567
> > SELECT @hid
> >
> > select gives me the value 12345678901234566 whereas it
> > should be 12345678901234567.
> >
> > Can anyone shed some light on this.
> >
> > Thanks,
> > Harsha
>


J Posted on 2009-10-20 00:04:30.0Z
From: jtotally_bogus@sbcglobal.net (J)
Newsgroups: sybase.public.ase.general
Subject: Re: Numeric Datatype
Reply-To: J@bogusemailAddress.com
Message-ID: <4adcfe68.35922223@forums.sybase.com>
References: <pan.2009.10.17.15.17.28.452341@peppler.org> <4adc796b.7dae.1681692777@sybase.com>
X-Newsreader: Forte Free Agent 1.21/32.243
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 19 Oct 2009 17:04:30 -0700
X-Trace: forums-1-dub 1255997070 10.22.241.152 (19 Oct 2009 17:04:30 -0700)
X-Original-Trace: 19 Oct 2009 17:04:30 -0700, vip152.sybase.com
Lines: 69
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28508
Article PK: 77750

On 19 Oct 2009 07:36:27 -0700, Harsha wrote:

See what this returns:

select convert(char(20), convert(numeric(17,0), 12345678901234567))

J

>Thanks for your help. I'm using SqlDbx v3.11 (Professional
>Edition) tool as a SQL Developer IDE. It can be because of
>that tool as even if I connect to SQL Server using that tool
>it gives me the same wrong number.
>
>> That works for me as well:
>>
>> [45] SYBASE.bugdb.1> DECLARE @hid NUMERIC(17, 0)
>> [45] SYBASE.bugdb.2> SET @hid = 12345678901234567
>> [45] SYBASE.bugdb.3> SELECT @hid
>> [45] SYBASE.bugdb.4> go
>> (1 row affected)
>>
>> --------------------
>> 12345678901234567
>>
>> (1 row affected)
>>
>> That's on a 12.5.3 server.
>>
>> What tool are you using?
>>
>> It is possible that your tool is converting the large
>> numeric() data to float, and float has a 15 digit
>> precision limit, if I recall correctly.
>>
>> Michael
>>
>> On Fri, 16 Oct 2009 13:22:00 -0700, Harsha wrote:
>>
>> > Hi,
>> >
>> > If I create a numeric variable up to 16 precision with 0
>> > scale and tries to enter value up to 16 digit long
>> > number it works fine.
>> >
>> > DECLARE @hid NUMERIC(16, 0)
>> > SET @hid = 1234567890123456
>> > SELECT @hid
>> >
>> > But when I creates the numeric variable with precision
>> > above 17 and assigns it the value of 17 digit long
>> > number. While selecting the value it returns the number
>> > up to 16 digit correctly but for the last digit if it's
>> > odd value it returns me the one number less than that
>> > i.e. if last digit is 7 it returns me the value 6 and
>> > if it's even number it returns me the correct value.
>> > Here is the example.
>> > DECLARE @hid NUMERIC(17, 0)
>> > SET @hid = 12345678901234567
>> > SELECT @hid
>> >
>> > select gives me the value 12345678901234566 whereas it
>> > should be 12345678901234567.
>> >
>> > Can anyone shed some light on this.
>> >
>> > Thanks,
>> > Harsha
>>


sqldbxhelp Posted on 2009-10-20 11:15:54.0Z
From: sqldbxhelp <alexg00@hotmail.com>
Newsgroups: sybase.public.ase.general
Subject: Re: Numeric Datatype
Date: Tue, 20 Oct 2009 04:15:54 -0700 (PDT)
Organization: http://groups.google.com
Lines: 64
Message-ID: <548a78b9-15f8-4139-bfc9-1bcfe1f04e68@o21g2000vbl.googlegroups.com>
References: <pan.2009.10.17.15.17.28.452341@peppler.org> <4adc796b.7dae.1681692777@sybase.com>
NNTP-Posting-Host: 69.120.52.38
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1256037355 2058 127.0.0.1 (20 Oct 2009 11:15:55 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 20 Oct 2009 11:15:55 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: o21g2000vbl.googlegroups.com; posting-host=69.120.52.38; posting-account=j_wQtAoAAACexTMwaO3GENZNcSSxGd8M
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3,gzip(gfe),gzip(gfe)
Path: forums-1-dub!forums-master!newssvr.sybase.com!news-sj-1.sprintlink.net!news-peer1.sprintlink.net!newsfeed.yul.equant.net!novia!news-out.readnews.com!news-xxxfer.readnews.com!postnews.google.com!o21g2000vbl.googlegroups.com!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28511
Article PK: 77753


On Oct 19, 10:36 am, Harsha wrote:
> Thanks for your help. I'm usingSqlDbxv3.11 (Professional
> Edition) tool as a SQL Developer IDE. It can be because of
> that tool as even if I connect to SQL Server using that tool
> it gives me the same wrong number.
>
> > That works for me as well:
>
> > [45] SYBASE.bugdb.1> DECLARE @hid NUMERIC(17, 0)
> > [45] SYBASE.bugdb.2> SET @hid = 12345678901234567
> > [45] SYBASE.bugdb.3> SELECT @hid
> > [45] SYBASE.bugdb.4> go
> > (1 row affected)
>
> >  --------------------
> >     12345678901234567
>
> > (1 row affected)
>
> > That's on a 12.5.3 server.
>
> > What tool are you using?
>
> > It is possible that your tool is converting the large
> > numeric() data to float, and float has a 15 digit
> > precision limit, if I recall correctly.
>
> > Michael
>
> > On Fri, 16 Oct 2009 13:22:00 -0700, Harsha wrote:
>
> > > Hi,
>
> > > If I create a numeric variable up to 16 precision with 0
> > > scale and tries to enter value up to 16 digit long
> > > number it works fine.
>
> > > DECLARE @hid    NUMERIC(16, 0)
> > > SET @hid = 1234567890123456
> > > SELECT @hid
>
> > > But when I creates the numeric variable with precision
> > > above 17 and assigns it the value of 17 digit long
> > > number. While selecting the value it returns the number
> > > up to 16 digit correctly but for the last digit if it's
> > > odd value it returns me the one number less than that
> > > i.e. if last digit is 7 it returns me the value 6  and
> > > if it's even number it returns me the correct value.
> > > Here is the example.
> > > DECLARE @hid    NUMERIC(17, 0)
> > > SET @hid = 12345678901234567
> > > SELECT @hid
>
> > > select gives me the value 12345678901234566 whereas it
> > > should be 12345678901234567.
>
> > > Can anyone shed some light on this.
>
> > > Thanks,
> > > Harsha

Older version of SqlDbx used to convert numeric type to double and
that is why you see truncation.
New version does not convert to double so you will see correct result