ExamNotes.net  -  IT certification portal

ForumsCertResearchTop sitesNewslettersFree email
HomeRegister


Exams Notes
Practice exams
Exam games
Questions by email
Online training
Training videos
College degrees
Boot camps
Book store
Links directory
Tell a friend
For webmasters




General discussions > Public newsgroups > microsoft.public.sqlserver.server > What is wrong in this Precession?

Show a Printable Version
Email This Page to Someone!
Receive updates to this thread



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

Old Post 12-13-02 08:23 AM
Reply w/Quote Edit/Delete Message IP: Logged
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

Old Post 12-13-02 08:23 AM
Reply w/Quote Edit/Delete Message IP: Logged
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

Old Post 12-13-02 08:23 AM
Reply w/Quote Edit/Delete Message IP: Logged
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

Old Post 12-13-02 08:23 AM
Reply w/Quote Edit/Delete Message IP: Logged
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

Old Post 12-13-02 08:23 AM
Reply w/Quote Edit/Delete Message IP: Logged
;-\) ~~~~~~~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

Old Post 12-13-02 03:23 PM
Reply w/Quote Edit/Delete Message IP: Logged
All times are GMT.
Post new thread   Post reply


Forum Jump:
Rate This Thread:
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


Powered by: vBulletin 2.2.8
Copyright ©2000, Jelsoft Enterprises Limited.

  Free Braindumps | mcse braindumps