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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

decimal part

Status
Not open for further replies.

Waynest

Programmer
Jun 22, 2000
321
GB
Hi

(SQL 7)

If, within a stored procedure, If I have a decimal(14,4) field holding 1234.5678

How do I reference the part after the decimal point?

Thanks

 
You could use the round function

e.g.

Say variable 'pre' = 1234.5678

use: round(pre,0) - pre

Damian.
 
What do you mean by 'reference the part after the decimal point'?

Do you mean that you just want to use the last part of the number? If so try this:

DECLARE @mynumber DECIMAL(14,4)
SET @mynumber = 1234.5678
SELECT @mynumber,
RIGHT(@mynumber, 4) AS Without_Decimal_Point,
RIGHT(@mynumber, 5) AS With_Decimal_Point

-SQLBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top