🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11276

Re: Percentage in Stored Procedure

#11276
From: Aage Johansen
Date: Mon, 02 Dec 2002 13:02
28 lines
1629 bytes
Will Bonner-May wrote:
> 
> Can anyone help?
> 
> I need to work out a score as a percentage within a stored procedure, I am
> using the following code but it doesn't seem to work.
> 
> (TOPICCOUNT integer,
>  TOPICSCOMPLETED integer,
>  USERSYLLABUSPROGRESS integer)
> 
> .....
> UserSyllabusProgress = (:TopicsCompleted / :TopicCount) * 100;
> .....


What do you mean by "doesn't seem to work"?  Error message?  Just gives
0?

OtToMH: Will
 UserSyllabusProgress = (cast(:TopicsCompleted as
float)/:TopicCount)*100 
work?
You will probably have to convert it into an integer with rounding or
truncation according to preferences ...

--
Aage J.
Technical Details
Message-ID: <3DEB59D6.432D6257@offline.no>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-04!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3deb500b$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,a766b6afb0ff7831
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-12-02 05:06:09 PST
Message-ID: <3DEB59D6.432D6257@offline.no>
Date: Mon, 02 Dec 2002 14:02:14 +0100
From: Aage Johansen <aagjohan@offline.no>
X-Mailer: Mozilla 4.72 [en] (Windows NT 5.0; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: borland.public.interbase.sql
Subject: Re: Percentage in Stored Procedure
References: <3deb500b$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 80.212.44.202
X-Trace: newsgroups.borland.com 1038834148 80.212.44.202 (2 Dec 2002 05:02:28 -0800)
Lines: 29
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-04!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail