Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiplying integers to decimal fields

Status
Not open for further replies.

gcole

Programmer
Joined
Aug 2, 2000
Messages
390
Location
US
The following formula is working but it seems rather ugly. Is there a better way to get calculated integers to show up in a decimal field?

SET Multiplier = (convert(decimal (18, 4),Accounts) - convert(decimal (18, 4),Contacts)) / convert(decimal (18, 4),Accounts)


Data types used:
Multiplier is a decimal
Accounts and Contacts are integers.
 
I think, as the top of the fraction will always be an integer answer you could put their convert after you have subtracted them the formula becoming:

= (convert(decimal (18, 4),(Accounts - Contacts)) / convert(decimal (18, 4),Accounts))

Can't think of anything neater offhand
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top