Format function

  • Thread starter Thread starter Bryan
  • Start date Start date
B

Bryan

I see the format function is not supported with SQL . Is
there a equivilant I can use.

e.g.
[integer datatype]

format(employee_number,"000000") so all employee numbers
display in a 6 digit length

052365
002563
000235

instead of

52365
2563
235


thanks folks
 
Hi Brian !

Try this:

RIGHT("000000"+convert(varchar, NAME_OF_COLUMN), 6)

HTH, Jens Süßmeyer.
 
Thanks. I will give it a try.
-----Original Message-----
Hi Brian !

Try this:

RIGHT("000000"+convert(varchar, NAME_OF_COLUMN), 6)

HTH, Jens Süßmeyer.

Bryan said:
I see the format function is not supported with SQL . Is
there a equivilant I can use.

e.g.
[integer datatype]

format(employee_number,"000000") so all employee numbers
display in a 6 digit length

052365
002563
000235

instead of

52365
2563
235


thanks folks


.
 
can make your MyFormat :


ALTER FUNCTION MyFormat (@strFormat nvarchar(255), @StrOrigen
nvarchar(255))
RETURNS nvarchar(255)
AS
BEGIN
RETURN SUBSTRING ( @strFormat , 1 , Len(@strFormat) - Len(@StrOrigen))
+ @strOrigen
END







Jens Süßmeyer said:
Hi Brian !

Try this:

RIGHT("000000"+convert(varchar, NAME_OF_COLUMN), 6)

HTH, Jens Süßmeyer.

Bryan said:
I see the format function is not supported with SQL . Is
there a equivilant I can use.

e.g.
[integer datatype]

format(employee_number,"000000") so all employee numbers
display in a 6 digit length

052365
002563
000235

instead of

52365
2563
235


thanks folks
 
Back
Top