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.

implicit datatype conversion

7 posts in General Discussion Last posting was on 2009-09-22 22:31:24.0Z
Alexander Posted on 2009-09-18 07:49:01.0Z
Sender: 5db1.4ab330dd.1804289383@sybase.com
From: alexander
Newsgroups: sybase.public.ase.general
Subject: implicit datatype conversion
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4ab33b6d.5f59.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 18 Sep 2009 00:49:01 -0700
X-Trace: forums-1-dub 1253260141 10.22.241.41 (18 Sep 2009 00:49:01 -0700)
X-Original-Trace: 18 Sep 2009 00:49:01 -0700, 10.22.241.41
Lines: 40
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28321
Article PK: 77565

Hello, everybody!
I've encountered a problem with implicit datatype
conversion. I have a result table T1 defined as follows

create table T1 (col1 decimal(21,6) null).

Also i have source table defined as follows

create table S1 (col1 decimal(18,6) null).

The problem appears when i perform this operation

update T1
set T1.col1 = S1.col1 / 30

Then i receive message "Truncation error occured." Numbers
in S1 are trivially smaller than datatype decimal(21,6) able
to save.

I've read about implicit conversions of datatypes during
arithmetic operations, but there is nothing said about to
what decimal datatype int is converted (default (18,0) or to
the (18,6)). Besides when i perform addition, subtraction
and multiplication they are done without erros. So the
questions are:
1.What's wrong with division?
2.To what exactly datatype integer will be converted?
3.Will be there any conversions between two equal decimals
according to sybase formula, say (18,6)?
4.Why are addition, subtraction and multiplication performed
well and division not?

P.S. I know that this will work
update T1
set T1.col1 = convert(decimal(21,6),(S1.col1 / 30))
but the questions exist.
Will such conversion harm performance?
I work with ASE 12.5.4 64-bit.

Thanks.


Alexander Posted on 2009-09-18 13:52:29.0Z
Sender: 5db1.4ab330dd.1804289383@sybase.com
From: alexander
Newsgroups: sybase.public.ase.general
Subject: Re: implicit datatype conversion
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4ab3909d.6db9.1681692777@sybase.com>
References: <4ab33b6d.5f59.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 18 Sep 2009 06:52:29 -0700
X-Trace: forums-1-dub 1253281949 10.22.241.41 (18 Sep 2009 06:52:29 -0700)
X-Original-Trace: 18 Sep 2009 06:52:29 -0700, 10.22.241.41
Lines: 47
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28324
Article PK: 77568

I've understood what's wrong with division.
When dividing on some integers you get answer with period in
decimal fraction (e.g.
3.373737373737373737373737373737373737)
and we get scale overflow. But questions about implicit
conversions still need answers:).

> Hello, everybody!
> I've encountered a problem with implicit datatype
> conversion. I have a result table T1 defined as follows
>
> create table T1 (col1 decimal(21,6) null).
>
> Also i have source table defined as follows
>
> create table S1 (col1 decimal(18,6) null).
>
> The problem appears when i perform this operation
>
> update T1
> set T1.col1 = S1.col1 / 30
>
> Then i receive message "Truncation error occured." Numbers
> in S1 are trivially smaller than datatype decimal(21,6)
> able to save.
>
> I've read about implicit conversions of datatypes during
> arithmetic operations, but there is nothing said about to
> what decimal datatype int is converted (default (18,0) or
> to the (18,6)). Besides when i perform addition,
> subtraction and multiplication they are done without
> erros. So the questions are:
> 1.What's wrong with division?
> 2.To what exactly datatype integer will be converted?
> 3.Will be there any conversions between two equal decimals
> according to sybase formula, say (18,6)?
> 4.Why are addition, subtraction and multiplication
> performed well and division not?
>
> P.S. I know that this will work
> update T1
> set T1.col1 = convert(decimal(21,6),(S1.col1 / 30))
> but the questions exist.
> Will such conversion harm performance?
> I work with ASE 12.5.4 64-bit.
>
> Thanks.


J Posted on 2009-09-18 15:56:27.0Z
From: jtotally_bogus@sbcglobal.net (J)
Newsgroups: sybase.public.ase.general
Subject: Re: implicit datatype conversion
Reply-To: J@bogusemailAddress.com
Message-ID: <4ab3acd3.3210907@forums.sybase.com>
References: <4ab33b6d.5f59.1681692777@sybase.com> <4ab3909d.6db9.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: 18 Sep 2009 08:56:27 -0700
X-Trace: forums-1-dub 1253289387 10.22.241.152 (18 Sep 2009 08:56:27 -0700)
X-Original-Trace: 18 Sep 2009 08:56:27 -0700, vip152.sybase.com
Lines: 58
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28328
Article PK: 77571

On 18 Sep 2009 06:52:29 -0700, alexander wrote:

google "implicit conversion site:sybase.com" or alternatively look in
Chapter 2. Transact Sql- Functions of TSQL guide for a discussion and
conversion table. I think it might be appropriate to make or check on
feature requests if you think an appropriate conversion is not
"implicit".

Jay

>I've understood what's wrong with division.
>When dividing on some integers you get answer with period in
>decimal fraction (e.g.
>3.373737373737373737373737373737373737)
>and we get scale overflow. But questions about implicit
>conversions still need answers:).
>
>> Hello, everybody!
>> I've encountered a problem with implicit datatype
>> conversion. I have a result table T1 defined as follows
>>
>> create table T1 (col1 decimal(21,6) null).
>>
>> Also i have source table defined as follows
>>
>> create table S1 (col1 decimal(18,6) null).
>>
>> The problem appears when i perform this operation
>>
>> update T1
>> set T1.col1 = S1.col1 / 30
>>
>> Then i receive message "Truncation error occured." Numbers
>> in S1 are trivially smaller than datatype decimal(21,6)
>> able to save.
>>
>> I've read about implicit conversions of datatypes during
>> arithmetic operations, but there is nothing said about to
>> what decimal datatype int is converted (default (18,0) or
>> to the (18,6)). Besides when i perform addition,
>> subtraction and multiplication they are done without
>> erros. So the questions are:
>> 1.What's wrong with division?
>> 2.To what exactly datatype integer will be converted?
>> 3.Will be there any conversions between two equal decimals
>> according to sybase formula, say (18,6)?
>> 4.Why are addition, subtraction and multiplication
>> performed well and division not?
>>
>> P.S. I know that this will work
>> update T1
>> set T1.col1 = convert(decimal(21,6),(S1.col1 / 30))
>> but the questions exist.
>> Will such conversion harm performance?
>> I work with ASE 12.5.4 64-bit.
>>
>> Thanks.


Alexander Posted on 2009-09-18 21:15:56.0Z
Sender: 7cf9.4ab3f25a.1804289383@sybase.com
From: alexander
Newsgroups: sybase.public.ase.general
Subject: Re: implicit datatype conversion
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4ab3f88c.7ddd.1681692777@sybase.com>
References: <4ab3acd3.3210907@forums.sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 18 Sep 2009 14:15:56 -0700
X-Trace: forums-1-dub 1253308556 10.22.241.41 (18 Sep 2009 14:15:56 -0700)
X-Original-Trace: 18 Sep 2009 14:15:56 -0700, 10.22.241.41
Lines: 81
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28332
Article PK: 77576

Hi, Jay.
Thanks for answer.
But it's not what I need. I've read TSQL users guide as well
as reference manual. And there is nothing said about
implicit conversions in chapters you've mentioned. I've read
how determine precision and scale of a result when you
perform arithmetic operations between different decimals.
But what about integers? There is only a table indicating
possibility of implicit conversion between different
datatypes in the reference manual.
But what decimal will I get when I perform multiplication
between decimal(15,5) and int (for example). Will be int
converted to decimal(18,0) as default difinition of decimal
or to decimal(15,5)?
When you perform this
a=b/c
you get implicit conversions.
When you perform this
a=convert(b/c)
you also get implicit conversion of b/c and then the result
explicitly converted to the datatype you need.

> On 18 Sep 2009 06:52:29 -0700, alexander wrote:
>
> google "implicit conversion site:sybase.com" or
> alternatively look in Chapter 2. Transact Sql- Functions
> of TSQL guide for a discussion and conversion table. I
> think it might be appropriate to make or check on feature
> requests if you think an appropriate conversion is not
> "implicit".
>
> Jay
>
> >I've understood what's wrong with division.
> >When dividing on some integers you get answer with period
> in >decimal fraction (e.g.
> >3.373737373737373737373737373737373737)
> >and we get scale overflow. But questions about implicit
> >conversions still need answers:).
> >
> >> Hello, everybody!
> >> I've encountered a problem with implicit datatype
> >> conversion. I have a result table T1 defined as follows
> >>
> >> create table T1 (col1 decimal(21,6) null).
> >>
> >> Also i have source table defined as follows
> >>
> >> create table S1 (col1 decimal(18,6) null).
> >>
> >> The problem appears when i perform this operation
> >>
> >> update T1
> >> set T1.col1 = S1.col1 / 30
> >>
> >> Then i receive message "Truncation error occured."
> Numbers >> in S1 are trivially smaller than datatype
> decimal(21,6) >> able to save.
> >>
> >> I've read about implicit conversions of datatypes
> during >> arithmetic operations, but there is nothing said
> about to >> what decimal datatype int is converted
> (default (18,0) or >> to the (18,6)). Besides when i
> perform addition, >> subtraction and multiplication they
> are done without >> erros. So the questions are:
> >> 1.What's wrong with division?
> >> 2.To what exactly datatype integer will be converted?
> >> 3.Will be there any conversions between two equal
> decimals >> according to sybase formula, say (18,6)?
> >> 4.Why are addition, subtraction and multiplication
> >> performed well and division not?
> >>
> >> P.S. I know that this will work
> >> update T1
> >> set T1.col1 = convert(decimal(21,6),(S1.col1 / 30))
> >> but the questions exist.
> >> Will such conversion harm performance?
> >> I work with ASE 12.5.4 64-bit.
> >>
> >> Thanks.
>


Sherlock, Kevin [TeamSybase] Posted on 2009-09-18 22:14:24.0Z
From: "Sherlock, Kevin [TeamSybase]" <kevin.sherlock@teamsybase.com>
Newsgroups: sybase.public.ase.general
References: <4ab3acd3.3210907@forums.sybase.com> <4ab3f88c.7ddd.1681692777@sybase.com>
Subject: Re: implicit datatype conversion
Lines: 125
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4ab40640$1@forums-1-dub>
Date: 18 Sep 2009 15:14:24 -0700
X-Trace: forums-1-dub 1253312064 10.22.241.152 (18 Sep 2009 15:14:24 -0700)
X-Original-Trace: 18 Sep 2009 15:14:24 -0700, vip152.sybase.com
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28333
Article PK: 77577

1> select @@version as "ASE_Version"
2> , convert(decimal(15,5),1) * convert(int,1) as "Num_times_Int"
3> , convert(decimal(15,5),1) / convert(int,1) as "Num_divide_Int"
4> into #tmp
5> select * from #tmp
6> exec tempdb..sp_help #tmp
7> drop table #tmp
8>
9> go
(1 row affected)

ASE_Version

Num_times_Int Num_divide_Int

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

Adaptive Server Enterprise/15.0.3/EBF 16743 ESD#2/P/Linux
Intel/Linux 2.6.9-42.ELsmp i686/ase1503/2707/32-bit/FBO/Sun Jul 26
23:03:48 2009
1.000000 1.000000

(1 row affected)
Name Owner Object_type Create_date
--------------------- ----- ----------- -------------------
#tmp00000130018514529 dbo user table Sep 18 2009 5:13PM

Column_name Type Length Prec Scale Nulls Default_name Rule_name
Access_Rule_name Computed_Column_object Identity
-------------- ------- ------ ---- ----- ----- ------------ --------- ----------------
---------------------- ----------
ASE_Version varchar 255 NULL NULL 1 NULL NULL NULL
NULL 0
Num_times_Int decimal 12 26 5 0 NULL NULL NULL
NULL 0
Num_divide_Int decimal 12 26 16 0 NULL NULL NULL
NULL 0
Object does not have any indexes.

<alexander> wrote in message news:4ab3f88c.7ddd.1681692777@sybase.com...
> Hi, Jay.
> Thanks for answer.
> But it's not what I need. I've read TSQL users guide as well
> as reference manual. And there is nothing said about
> implicit conversions in chapters you've mentioned. I've read
> how determine precision and scale of a result when you
> perform arithmetic operations between different decimals.
> But what about integers? There is only a table indicating
> possibility of implicit conversion between different
> datatypes in the reference manual.
> But what decimal will I get when I perform multiplication
> between decimal(15,5) and int (for example). Will be int
> converted to decimal(18,0) as default difinition of decimal
> or to decimal(15,5)?
> When you perform this
> a=b/c
> you get implicit conversions.
> When you perform this
> a=convert(b/c)
> you also get implicit conversion of b/c and then the result
> explicitly converted to the datatype you need.
>
>> On 18 Sep 2009 06:52:29 -0700, alexander wrote:
>>
>> google "implicit conversion site:sybase.com" or
>> alternatively look in Chapter 2. Transact Sql- Functions
>> of TSQL guide for a discussion and conversion table. I
>> think it might be appropriate to make or check on feature
>> requests if you think an appropriate conversion is not
>> "implicit".
>>
>> Jay
>>
>> >I've understood what's wrong with division.
>> >When dividing on some integers you get answer with period
>> in >decimal fraction (e.g.
>> >3.373737373737373737373737373737373737)
>> >and we get scale overflow. But questions about implicit
>> >conversions still need answers:).
>> >
>> >> Hello, everybody!
>> >> I've encountered a problem with implicit datatype
>> >> conversion. I have a result table T1 defined as follows
>> >>
>> >> create table T1 (col1 decimal(21,6) null).
>> >>
>> >> Also i have source table defined as follows
>> >>
>> >> create table S1 (col1 decimal(18,6) null).
>> >>
>> >> The problem appears when i perform this operation
>> >>
>> >> update T1
>> >> set T1.col1 = S1.col1 / 30
>> >>
>> >> Then i receive message "Truncation error occured."
>> Numbers >> in S1 are trivially smaller than datatype
>> decimal(21,6) >> able to save.
>> >>
>> >> I've read about implicit conversions of datatypes
>> during >> arithmetic operations, but there is nothing said
>> about to >> what decimal datatype int is converted
>> (default (18,0) or >> to the (18,6)). Besides when i
>> perform addition, >> subtraction and multiplication they
>> are done without >> erros. So the questions are:
>> >> 1.What's wrong with division?
>> >> 2.To what exactly datatype integer will be converted?
>> >> 3.Will be there any conversions between two equal
>> decimals >> according to sybase formula, say (18,6)?
>> >> 4.Why are addition, subtraction and multiplication
>> >> performed well and division not?
>> >>
>> >> P.S. I know that this will work
>> >> update T1
>> >> set T1.col1 = convert(decimal(21,6),(S1.col1 / 30))
>> >> but the questions exist.
>> >> Will such conversion harm performance?
>> >> I work with ASE 12.5.4 64-bit.
>> >>
>> >> Thanks.
>>


Alexander Posted on 2009-09-20 16:12:11.0Z
Sender: 7de7.4ab3f8c4.1804289383@sybase.com
From: alexander
Newsgroups: sybase.public.ase.general
Subject: Re: implicit datatype conversion
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4ab6545b.6d6b.1681692777@sybase.com>
References: <4ab40640$1@forums-1-dub>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 20 Sep 2009 09:12:11 -0700
X-Trace: forums-1-dub 1253463131 10.22.241.41 (20 Sep 2009 09:12:11 -0700)
X-Original-Trace: 20 Sep 2009 09:12:11 -0700, 10.22.241.41
Lines: 137
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28334
Article PK: 77578

Thanks, Kevin!

> 1> select @@version as "ASE_Version"
> 2> , convert(decimal(15,5),1) * convert(int,1) as
> "Num_times_Int" 3> , convert(decimal(15,5),1) /
> convert(int,1) as "Num_divide_Int" 4> into #tmp
> 5> select * from #tmp
> 6> exec tempdb..sp_help #tmp
> 7> drop table #tmp
> 8>
> 9> go
> (1 row affected)
>
> ASE_Version
>
> Num_times_Int Num_divide_Int
>
>
> ----------------------------------------------------------
> ----------------------------------------------------------
> --------
> ----------------------------------------------------------
> ----------------------------------------------------------
> ---------------
> -------------------- --------------------
>
> Adaptive Server Enterprise/15.0.3/EBF 16743
> ESD#2/P/Linux Intel/Linux 2.6.9-42.ELsmp
> i686/ase1503/2707/32-bit/FBO/Sun Jul 26
> 23:03:48 2009
> 1.000000 1.000000
>
> (1 row affected)
> Name Owner Object_type Create_date
> --------------------- ----- -----------
> -------------------
> #tmp00000130018514529 dbo user table Sep 18 2009
> 5:13PM
>
> Column_name Type Length Prec Scale Nulls
> Default_name Rule_name Access_Rule_name
> Computed_Column_object Identity
> -------------- ------- ------ ---- ----- -----
> ------------ --------- ----------------
> ---------------------- ----------
> ASE_Version varchar 255 NULL NULL 1 NULL
> NULL NULL NULL 0
> Num_times_Int decimal 12 26 5 0 NULL
> NULL NULL NULL 0
> Num_divide_Int decimal 12 26 16 0 NULL
> NULL NULL NULL 0
> Object does not have any indexes.
>
> <alexander> wrote in message
> > news:4ab3f88c.7ddd.1681692777@sybase.com... Hi, Jay.
> > Thanks for answer.
> > But it's not what I need. I've read TSQL users guide as
> > well as reference manual. And there is nothing said
> > about implicit conversions in chapters you've mentioned.
> > I've read how determine precision and scale of a result
> > when you perform arithmetic operations between different
> > decimals. But what about integers? There is only a table
> > indicating possibility of implicit conversion between
> > different datatypes in the reference manual.
> > But what decimal will I get when I perform
> > multiplication between decimal(15,5) and int (for
> > example). Will be int converted to decimal(18,0) as
> > default difinition of decimal or to decimal(15,5)?
> > When you perform this
> > a=b/c
> > you get implicit conversions.
> > When you perform this
> > a=convert(b/c)
> > you also get implicit conversion of b/c and then the
> > result explicitly converted to the datatype you need.
> >
> >> On 18 Sep 2009 06:52:29 -0700, alexander wrote:
> >>
> >> google "implicit conversion site:sybase.com" or
> >> alternatively look in Chapter 2. Transact Sql-
> Functions >> of TSQL guide for a discussion and conversion
> table. I >> think it might be appropriate to make or
> check on feature >> requests if you think an appropriate
> conversion is not >> "implicit".
> >>
> >> Jay
> >>
> >> >I've understood what's wrong with division.
> >> >When dividing on some integers you get answer with
> period >> in >decimal fraction (e.g.
> >> >3.373737373737373737373737373737373737)
> >> >and we get scale overflow. But questions about
> implicit >> >conversions still need answers:).
> >> >
> >> >> Hello, everybody!
> >> >> I've encountered a problem with implicit datatype
> >> >> conversion. I have a result table T1 defined as
> follows >> >>
> >> >> create table T1 (col1 decimal(21,6) null).
> >> >>
> >> >> Also i have source table defined as follows
> >> >>
> >> >> create table S1 (col1 decimal(18,6) null).
> >> >>
> >> >> The problem appears when i perform this operation
> >> >>
> >> >> update T1
> >> >> set T1.col1 = S1.col1 / 30
> >> >>
> >> >> Then i receive message "Truncation error occured."
> >> Numbers >> in S1 are trivially smaller than datatype
> >> decimal(21,6) >> able to save.
> >> >>
> >> >> I've read about implicit conversions of datatypes
> >> during >> arithmetic operations, but there is nothing
> said >> about to >> what decimal datatype int is converted
> >> (default (18,0) or >> to the (18,6)). Besides when i
> >> perform addition, >> subtraction and multiplication
> they >> are done without >> erros. So the questions are:
> >> >> 1.What's wrong with division?
> >> >> 2.To what exactly datatype integer will be
> converted? >> >> 3.Will be there any conversions between
> two equal >> decimals >> according to sybase formula, say
> (18,6)? >> >> 4.Why are addition, subtraction and
> multiplication >> >> performed well and division not?
> >> >>
> >> >> P.S. I know that this will work
> >> >> update T1
> >> >> set T1.col1 = convert(decimal(21,6),(S1.col1 / 30))
> >> >> but the questions exist.
> >> >> Will such conversion harm performance?
> >> >> I work with ASE 12.5.4 64-bit.
> >> >>
> >> >> Thanks.
> >>
>
>


J Posted on 2009-09-22 22:31:24.0Z
From: jtotally_bogus@sbcglobal.net (J)
Newsgroups: sybase.public.ase.general
Subject: Re: implicit datatype conversion
Reply-To: J@bogusemailAddress.com
Message-ID: <4ab94ffc.25111338@forums.sybase.com>
References: <4ab3acd3.3210907@forums.sybase.com> <4ab3f88c.7ddd.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: 22 Sep 2009 15:31:24 -0700
X-Trace: forums-1-dub 1253658684 10.22.241.152 (22 Sep 2009 15:31:24 -0700)
X-Original-Trace: 22 Sep 2009 15:31:24 -0700, vip152.sybase.com
Lines: 90
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28346
Article PK: 77589

On 18 Sep 2009 14:15:56 -0700, alexander wrote:

Sorry. I was on vacation. I see your problem is a bit different from
my assumptions. Glad you got some help. I had assumed you wanted an
implicit conversion that was not available (my bad!).

Jay

>Hi, Jay.
>Thanks for answer.
>But it's not what I need. I've read TSQL users guide as well
>as reference manual. And there is nothing said about
>implicit conversions in chapters you've mentioned. I've read
>how determine precision and scale of a result when you
>perform arithmetic operations between different decimals.
>But what about integers? There is only a table indicating
>possibility of implicit conversion between different
>datatypes in the reference manual.
>But what decimal will I get when I perform multiplication
>between decimal(15,5) and int (for example). Will be int
>converted to decimal(18,0) as default difinition of decimal
>or to decimal(15,5)?
>When you perform this
>a=b/c
>you get implicit conversions.
>When you perform this
>a=convert(b/c)
>you also get implicit conversion of b/c and then the result
>explicitly converted to the datatype you need.
>
>> On 18 Sep 2009 06:52:29 -0700, alexander wrote:
>>
>> google "implicit conversion site:sybase.com" or
>> alternatively look in Chapter 2. Transact Sql- Functions
>> of TSQL guide for a discussion and conversion table. I
>> think it might be appropriate to make or check on feature
>> requests if you think an appropriate conversion is not
>> "implicit".
>>
>> Jay
>>
>> >I've understood what's wrong with division.
>> >When dividing on some integers you get answer with period
>> in >decimal fraction (e.g.
>> >3.373737373737373737373737373737373737)
>> >and we get scale overflow. But questions about implicit
>> >conversions still need answers:).
>> >
>> >> Hello, everybody!
>> >> I've encountered a problem with implicit datatype
>> >> conversion. I have a result table T1 defined as follows
>> >>
>> >> create table T1 (col1 decimal(21,6) null).
>> >>
>> >> Also i have source table defined as follows
>> >>
>> >> create table S1 (col1 decimal(18,6) null).
>> >>
>> >> The problem appears when i perform this operation
>> >>
>> >> update T1
>> >> set T1.col1 = S1.col1 / 30
>> >>
>> >> Then i receive message "Truncation error occured."
>> Numbers >> in S1 are trivially smaller than datatype
>> decimal(21,6) >> able to save.
>> >>
>> >> I've read about implicit conversions of datatypes
>> during >> arithmetic operations, but there is nothing said
>> about to >> what decimal datatype int is converted
>> (default (18,0) or >> to the (18,6)). Besides when i
>> perform addition, >> subtraction and multiplication they
>> are done without >> erros. So the questions are:
>> >> 1.What's wrong with division?
>> >> 2.To what exactly datatype integer will be converted?
>> >> 3.Will be there any conversions between two equal
>> decimals >> according to sybase formula, say (18,6)?
>> >> 4.Why are addition, subtraction and multiplication
>> >> performed well and division not?
>> >>
>> >> P.S. I know that this will work
>> >> update T1
>> >> set T1.col1 = convert(decimal(21,6),(S1.col1 / 30))
>> >> but the questions exist.
>> >> Will such conversion harm performance?
>> >> I work with ASE 12.5.4 64-bit.
>> >>
>> >> Thanks.
>>