I can't seem to get my numbers to right justify, but text works just fine. I
set
the format direction to "LTR" and the text right justifies, but when a
number is displayed it's always left justified. How do I correct this?Set the TextAllign property to the setting that you want.
"Lee" wrote:
> I can't seem to get my numbers to right justify, but text works just fine. I
> set
> the format direction to "LTR" and the text right justifies, but when a
> number is displayed it's always left justified. How do I correct this?
Showing posts with label justify. Show all posts
Showing posts with label justify. Show all posts
Friday, March 23, 2012
right justify left zero fill
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).
Stan Gosselin
On Fri, 28 Oct 2005 05:35:03 -0700, Stan wrote:
>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).
Hi Stan,
You can use the following expression:
RIGHT(REPLICATE('0', 11) + LTRIM(CAST(YourColumn * 100 AS INT)), 11)
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||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
"Hugo Kornelis" wrote:
> On Fri, 28 Oct 2005 05:35:03 -0700, Stan wrote:
>
> Hi Stan,
> You can use the following expression:
> RIGHT(REPLICATE('0', 11) + LTRIM(CAST(YourColumn * 100 AS INT)), 11)
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
|||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
"Stan" wrote:
[vbcol=seagreen]
> 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
>
> "Hugo Kornelis" wrote:
|||On Wed, 2 Nov 2005 13:24:02 -0800, Stan wrote:
>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.
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
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Thanks for the direction Hugo!
Stan Gosselin
"Hugo Kornelis" wrote:
> On Wed, 2 Nov 2005 13:24:02 -0800, Stan wrote:
>
> 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
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
sql
justified, left zero filled and no decimal. The field I am extracting data
from is 'amount' and defined as decimal 9(15,2).
Stan Gosselin
On Fri, 28 Oct 2005 05:35:03 -0700, Stan wrote:
>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).
Hi Stan,
You can use the following expression:
RIGHT(REPLICATE('0', 11) + LTRIM(CAST(YourColumn * 100 AS INT)), 11)
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||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
"Hugo Kornelis" wrote:
> On Fri, 28 Oct 2005 05:35:03 -0700, Stan wrote:
>
> Hi Stan,
> You can use the following expression:
> RIGHT(REPLICATE('0', 11) + LTRIM(CAST(YourColumn * 100 AS INT)), 11)
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
|||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
"Stan" wrote:
[vbcol=seagreen]
> 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
>
> "Hugo Kornelis" wrote:
|||On Wed, 2 Nov 2005 13:24:02 -0800, Stan wrote:
>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.
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
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Thanks for the direction Hugo!
Stan Gosselin
"Hugo Kornelis" wrote:
> On Wed, 2 Nov 2005 13:24:02 -0800, Stan wrote:
>
> 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
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
sql
Right justify char column
How do I get the output of a SELECT statement to right justify a char (datat
ype) column?
Thanks,
JeffCan't you do that at the application / presentation layer?
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Jeff C." <anonymous@.discussions.microsoft.com> wrote in message
news:E7E61AC1-A8B4-4E43-B502-0B794F564A65@.microsoft.com...
> How do I get the output of a SELECT statement to right justify a char
(datatype) column?
> Thanks,
> Jeff|||Jeff C. wrote:
> How do I get the output of a SELECT statement to right justify a char
> (datatype) column?
Taken from
http://groups.google.pl/groups?hl=p...&rnu
m=3
Declare @.InVal Char(38)
Declare @.ReplaceChar Char(1)
Select @.InVal = 'This is a test'
Select @.ReplaceChar ='x'
Select Replicate(@.ReplaceChar, 38 - Len(@.InVal)) + @.InVal
sincerely,
--
Sebastian K. Zaklada
Skilled Software
http://www.skilledsoftware.com
This posting is provided "AS IS" with no warranties, and confers no rights.
ype) column?
Thanks,
JeffCan't you do that at the application / presentation layer?
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Jeff C." <anonymous@.discussions.microsoft.com> wrote in message
news:E7E61AC1-A8B4-4E43-B502-0B794F564A65@.microsoft.com...
> How do I get the output of a SELECT statement to right justify a char
(datatype) column?
> Thanks,
> Jeff|||Jeff C. wrote:
> How do I get the output of a SELECT statement to right justify a char
> (datatype) column?
Taken from
http://groups.google.pl/groups?hl=p...&rnu
m=3
Declare @.InVal Char(38)
Declare @.ReplaceChar Char(1)
Select @.InVal = 'This is a test'
Select @.ReplaceChar ='x'
Select Replicate(@.ReplaceChar, 38 - Len(@.InVal)) + @.InVal
sincerely,
--
Sebastian K. Zaklada
Skilled Software
http://www.skilledsoftware.com
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to:
Posts (Atom)