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

remove decimal when Cast number to Varchar 1

Status
Not open for further replies.

RustyAfro

Programmer
Jan 12, 2005
332
0
0
US
I have a simple cast statement

CAST(aNumber AS VARCHAR(10)) that makes the number

111

to

'111.'

Can anyone tell me how to do the CAST properly so that the decimal is not included in the casted string?
 
try:

Code:
REPLACE(CAST (aNumber AS VARCHAR(10)),'.','')

OR:

Code:
CAST (INT(aNumber) AS VARCHAR(10))

Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top