April 8, 2005 at 2:37 pm
Hi,
Any suggestions on how to trim the decimal places off:
1,234,567.00 >> 1,234,567
Many thanks. Jeff
April 8, 2005 at 2:41 pm
CAST() or CONVERT() to an integer is my first thought. If it's a string, you can SUBSTRING using CHARINDEX to find the decimal point.
K. Brian Kelley
@kbriankelley
April 8, 2005 at 2:46 pm
declare @var varchar(20)
set @var = '1,234,567.00'
select Left(@var,len(@var) -3)
-------------------
1,234,567
April 8, 2005 at 2:54 pm
Hi, I used th datatype "money" to display commas ... but would like to chop off the decimals ... not sure if i can use variable in xp_sendmail in @query line?
here is the code i'm using ...
SELECT CAST(CONVERT(varchar,CAST(filesize_kb AS money),1)AS varchar) AS "FILESIZE_kb" FROM xyz
Many thanks. Jeff
April 8, 2005 at 3:05 pm
You might want to take a look at this thread. http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=169&messageid=170943
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply