Format function

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
 
J

Jens Süßmeyer

Hi Brian !

Try this:

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

HTH, Jens Süßmeyer.
 
B

Bryan

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


.
 
S

Samuel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top