February 20, 2006 at 10:39 am
Hi all,
I have a payrate column in SQL Server 2000 as a numeric (Precision=19, scale=5).
I need to export this value into a text file, the value has to be convert to string value with a fixed 10 precision and 4 decimal point (xxxxx.xxxx)
FOr example : 10 => 00010.0000
8.75 => 00008.7500
How to do that in the select statement (SQL Query)?
Thank you.
February 20, 2006 at 10:59 am
This is what DTS is good for. You can use a vb script on a datapump for that particular column.
February 20, 2006 at 1:46 pm
DECLARE
@NumberToModify NUMERIC(19,5)
SET @NumberToModify = 10
--Use your field name instead of @NumberToModify
SELECT REPLICATE('0',5-(LEN(@NumberToModify)-6))+CONVERT(VARCHAR(24),@NumberToModify)
HTH:
Mark
February 20, 2006 at 5:49 pm
Check out "STR function" in BOL
_____________
Code for TallyGenerator
February 20, 2006 at 6:59 pm
Jennifer,
I agree with Serqiy...
SELECT STR(yourcolumn,10,4)
FROM yourtable...
--Jeff Moden
Change is inevitable... Change for the better is not.
February 21, 2006 at 6:06 am
YOU CAN USE THE FOLLOWING QUERY :--
select replace(str(convert(varchar(14),convert(numeric(19,5),58)),10,4),' ','0') a
YOU CAN USE IN PLACE OF '58' YOUR COLUMN
OK
BYE!!!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply