all groups > sql server mseq > october 2005 >
You're in the

sql server mseq

group:

right justify left zero fill


right justify left zero fill Stan
10/28/2005 5:35:03 AM
sql server mseq:
I have to build a text file with a dollar amount that must be right
justified, left zero filled and no decimal. The field I am extracting data
from is 'amount' and defined as decimal 9(15,2).
--
Re: right justify left zero fill Stan
10/28/2005 1:22:02 PM
Thanks again Hugo. I'm just getting exposed to SQL and, because of a short
deadline, I am being lazy about finding the answers. I shoudl be looking
stuff up the old fashioned way.

--
Stan Gosselin


[quoted text, click to view]
Re: right justify left zero fill Hugo Kornelis
10/28/2005 9:59:45 PM
[quoted text, click to view]

Hi Stan,

You can use the following expression:

RIGHT(REPLICATE('0', 11) + LTRIM(CAST(YourColumn * 100 AS INT)), 11)

Best, Hugo
--

Re: right justify left zero fill Stan
11/2/2005 1:24:02 PM
Hugo,
If you don't mind, I have a variation on the last question. I have the same
type field (decimal 9(15,2)) and the recipient of a conversion .txt file want
to see just the meaningful digits, no decimals, no zero fill but does want to
see a trailing minus sign for negative numbers. So they want to see 550.45
as 55045 and -45.25 as 4525-.
Should I be sending things like this or should I do a re-post?
Thanks for understanding.
--
Stan Gosselin


[quoted text, click to view]
Re: right justify left zero fill Stan
11/3/2005 2:17:25 PM
Thanks for the direction Hugo!
Stan Gosselin


[quoted text, click to view]
Re: right justify left zero fill Hugo Kornelis
11/3/2005 11:11:49 PM
[quoted text, click to view]

Hi Stan,

Sending like this is fine, though a repost might attract more eyes.
Generally, if the subject really changes, post a new message. If it's a
variation on the question, use a reply.

I see that Steve has already answered the question. I trust that his
reply is what you wanted.

Best, Hugo
--

AddThis Social Bookmark Button