











|  |
| Author |
What is wrong in this Precession?
|
Guru S. Anand
Guest
Registered: Not Yet Location: Country: State: Certifications: Working on:
Total Posts: N/A
|
|
What is wrong in this Precession?
Hi all
When I query like
select Convert(decimal(8,4),(1/2))
The result is .0000
What I am missiong to get the result a .5000
Please Help.
Anand.
Report this post to a moderator
|
|
12-13-02 08:23 AM
|
|
Tibor Karaszi
Guest
Registered: Not Yet Location: Country: State: Certifications: Working on:
Total Posts: N/A
|
|
Re: What is wrong in this Precession?
1/2 is an integer division. Try 1.0/2.0 instead. Or use CAST.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=...ublic.sqlserver
"Guru S. Anand" <gurusanand@hotmail.com> wrote in message
news:044301c2a27a$2e9dd280$d7f
82ecf@TK2MSFTNGXA14...
> Hi all
>
> When I query like
>
> select Convert(decimal(8,4),(1/2))
>
> The result is .0000
>
> What I am missiong to get the result a .5000
>
> Please Help.
> Anand.
Report this post to a moderator
|
|
12-13-02 08:23 AM
|
|
Dejan Sarka
Guest
Registered: Not Yet Location: Country: State: Certifications: Working on:
Total Posts: N/A
|
|
Re: What is wrong in this Precession?
Hi!
Your expression (1/2) gets implicitly integer data type. Change it to
(1.0/2) or cast it explicitly, for example
select Convert(decimal(8,4),(1.0/2))
--
Dejan Sarka, SQL Server MVP
FAQ from Neil & others at: http://www.sqlserverfaq.com
Please reply only to the newsgroups.
PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Guru S. Anand" <gurusanand@hotmail.com> wrote in message
news:044301c2a27a$2e9dd280$d7f
82ecf@TK2MSFTNGXA14...
> Hi all
>
> When I query like
>
> select Convert(decimal(8,4),(1/2))
>
> The result is .0000
>
> What I am missiong to get the result a .5000
>
> Please Help.
> Anand.
Report this post to a moderator
|
|
12-13-02 08:23 AM
|
|
Guru S. Anand
Guest
Registered: Not Yet Location: Country: State: Certifications: Working on:
Total Posts: N/A
|
|
Re: What is wrong in this Precession?
Thanks,
Anand
>-----Original Message-----
>1/2 is an integer division. Try 1.0/2.0 instead. Or use
CAST.
>
>--
>Tibor Karaszi, SQL Server MVP
>Archive at: http://groups.google.com/groups?
oi=djq&as_ugroup=microsoft.public.sqlserver
>
>
>"Guru S. Anand" <gurusanand@hotmail.com> wrote in message
> news:044301c2a27a$2e9dd280$d7f
82ecf@TK2MSFTNGXA14...
>> Hi all
>>
>> When I query like
>>
>> select Convert(decimal(8,4),(1/2))
>>
>> The result is .0000
>>
>> What I am missiong to get the result a .5000
>>
>> Please Help.
>> Anand.
>
>
>.
>
Report this post to a moderator
|
|
12-13-02 08:23 AM
|
|
Anand
Guest
Registered: Not Yet Location: Country: State: Certifications: Working on:
Total Posts: N/A
|
|
Re: What is wrong in this Precession?
Thanks,
Anand
>-----Original Message-----
>Hi!
>
>Your expression (1/2) gets implicitly integer data type.
Change it to
>(1.0/2) or cast it explicitly, for example
>select Convert(decimal(8,4),(1.0/2))
>
>--
>Dejan Sarka, SQL Server MVP
>FAQ from Neil & others at: http://www.sqlserverfaq.com
>Please reply only to the newsgroups.
>PASS - the definitive, global community
>for SQL Server professionals - http://www.sqlpass.org
>
>"Guru S. Anand" <gurusanand@hotmail.com> wrote in message
> news:044301c2a27a$2e9dd280$d7f
82ecf@TK2MSFTNGXA14...
>> Hi all
>>
>> When I query like
>>
>> select Convert(decimal(8,4),(1/2))
>>
>> The result is .0000
>>
>> What I am missiong to get the result a .5000
>>
>> Please Help.
>> Anand.
>
>
>.
>
Report this post to a moderator
|
|
12-13-02 08:23 AM
|
|
;-\) ~~~~~~~Snake 77
Guest
Registered: Not Yet Location: Country: State: Certifications: Working on:
Total Posts: N/A
|
|
Re: What is wrong in this Precession?
change to 1./2 or 1/2.
--
Saludos
Ronny Arauna Bravo
"Guru S. Anand" <gurusanand@hotmail.com> wrote in message
news:057c01c2a27d$f983eea0$d4f
82ecf@TK2MSFTNGXA11...
>
> Thanks,
> Anand
>
> >-----Original Message-----
> >1/2 is an integer division. Try 1.0/2.0 instead. Or use
> CAST.
> >
> >--
> >Tibor Karaszi, SQL Server MVP
> >Archive at: http://groups.google.com/groups?
> oi=djq&as_ugroup=microsoft.public.sqlserver
> >
> >
> >"Guru S. Anand" <gurusanand@hotmail.com> wrote in message
> > news:044301c2a27a$2e9dd280$d7f
82ecf@TK2MSFTNGXA14...
> >> Hi all
> >>
> >> When I query like
> >>
> >> select Convert(decimal(8,4),(1/2))
> >>
> >> The result is .0000
> >>
> >> What I am missiong to get the result a .5000
> >>
> >> Please Help.
> >> Anand.
> >
> >
> >.
> >
Report this post to a moderator
|
|
12-13-02 03:23 PM
|
|
|
Forum Rules: Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author.
Posts: HTML code is OFF. Smilies are ON. vB code is ON. [IMG] code is OFF. |
|
ExamNotes forum archive
|