Wednesday, March 7, 2012
Format Numbers
From
@.Var = 123
to
@.Var = 000123
If you have leading zeros, then it is no longer an INT and it is now a
string.
DECLARE @.var INT;
SET @.var = 123;
SELECT RIGHT('000000' + RTRIM(@.var), 6);
"TBoon" <TBoon@.discussions.microsoft.com> wrote in message
news:4D0B6BFC-3C2F-4086-B250-47574EA91E25@.microsoft.com...
> How do I add leading ZEROs in front of an INT variable in TSQL?
> From
> @.Var = 123
> to
> @.Var = 000123
Sunday, February 26, 2012
Format Numbers
From
@.Var = 123
to
@.Var = 000123If you have leading zeros, then it is no longer an INT and it is now a
string.
DECLARE @.var INT;
SET @.var = 123;
SELECT RIGHT('000000' + RTRIM(@.var), 6);
"TBoon" <TBoon@.discussions.microsoft.com> wrote in message
news:4D0B6BFC-3C2F-4086-B250-47574EA91E25@.microsoft.com...
> How do I add leading ZEROs in front of an INT variable in TSQL?
> From
> @.Var = 123
> to
> @.Var = 000123
Format Numbers
From
@.Var = 123
to
@.Var = 000123If you have leading zeros, then it is no longer an INT and it is now a
string.
DECLARE @.var INT;
SET @.var = 123;
SELECT RIGHT('000000' + RTRIM(@.var), 6);
"TBoon" <TBoon@.discussions.microsoft.com> wrote in message
news:4D0B6BFC-3C2F-4086-B250-47574EA91E25@.microsoft.com...
> How do I add leading ZEROs in front of an INT variable in TSQL?
> From
> @.Var = 123
> to
> @.Var = 000123
Format Masking for creating leading periods
When I do not allow the textbox to grow and just append a long string of periods it looks fine in my report preview, but after I deploy everything appended after the primary field in that text box is missing?
My report has a lot of data to the right but it is collapsible so the fields to the left are a good distance away. This is why I am trying to include light visual aids that assist lining up data values. I am not stuck on the leading period idea but it seems the least cluttered.
AaronBump...
Does anyone have any solutions for masking fields?|||
Hello Aaron,
Can you try something like this in your field's expression:
=StrDup(25 - len(Fields!FIELD1.Value), ".") & Fields!FIELD1.Value
The 25 in my example would have to be higher than the maximum number of characters in your FIELD1 field. This will fill the rest of space (up to 25 characters) on the left of the field with period's, it should be adjusted to fill the rest of your textbox.
Hope this helps.
Jarret
Friday, February 24, 2012
Format date with leading zeros
We'd like to display them like this: 02/06/2006
Currently we have two types of dates we're dealing with. In the first
case
we have a datetime and we're doing this:
=FormatDateTime(Code.GetStartDate(),vbShortDate)
in the second we just have a date, and we set the format code to 'd'
by selecting one of three date formats that are offered when we hit the
... button
on the Format tab.
Anyway, in each case we want the leading zeros.
TIA,
JimLet me refine that.
I've solved this to a point by using mm/dd/yyyy in the format. But
it's entirely possible
that this will be used where we would want dd/mm/yyyy.
So I would want a format that will adapt to regional settings, but will
also show leading zeros.
But only if it's simple ;)|||Hi,
If I have understood your problem correctly, the "d" format code will do
this, according to the language property of the report.
E.g. if the date '8 Jan 2006 23:15:58' would display as '08/01/2006' if
format was set to "d" and Language to 'English(United Kingdom).
If Language was set to 'English(United States), it would display as
'01/08/2006'.
If Language was set to '=User.Language', it would display in whatever format
was set on the client machine.
I hope this helps.
Ed Allison
<jhcorey@.yahoo.com> wrote in message
news:1140125197.767867.274710@.g43g2000cwa.googlegroups.com...
> Let me refine that.
> I've solved this to a point by using mm/dd/yyyy in the format. But
> it's entirely possible
> that this will be used where we would want dd/mm/yyyy.
> So I would want a format that will adapt to regional settings, but will
> also show leading zeros.
> But only if it's simple ;)
>|||I probably should have added that that is what we were using
originally, and while it no doubt handles the different regional
formats, it would not display the leading zeros.|||Really? It does for me. Sorry not to have been of more help.
<jhcorey@.yahoo.com> wrote in message
news:1140194093.511041.100970@.z14g2000cwz.googlegroups.com...
>I probably should have added that that is what we were using
> originally, and while it no doubt handles the different regional
> formats, it would not display the leading zeros.
>|||Hmm...
This made me think that it has to do with the regional settings on my
machine.
So I went in there and changed the short date format to mm/dd/yyyy.
But that didn't do it. I'm running everything local (I think). But I
think I'm on a track.