Curtis Gibson
Old Hand
Points: 329
More actions
April 26, 2005 at 1:46 pm
#164182
I have the need to export decimal data to a text file without the decimals. Is it possible to format this data a follows:
before: 12345.67
after 1234567
TIA,
Curtis
Ninja's_RGR'us
SSC Guru
Points: 294069
April 26, 2005 at 1:49 pm
#555018
Declare @a as decimal(18,4)
set @a = 12345.67
Select replace (@a, '.', '')
--123456700
please note that you'll always get 4 decimals even if it's an integer
Frank Kalis
Points: 111183
April 27, 2005 at 12:45 am
#555100
Piggy-backing on Remi, try this:
SELECT
REPLACE(REPLACE(RTRIM(REPLACE(@a,'0',SPACE(1))),SPACE(1),'0'),'.','')
--Frank KalisMicrosoft SQL Server MVPWebmaster: http://www.insidesql.org/blogsMy blog: http://www.insidesql.org/blogs/frankkalis/[/url]
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply