0
I have the following structure:
|VALOR|
| 1 |
| 23 |
| 5 |
| 41 |
I have a need to transform:
| VALOR |
| 0001 |
| 0023 |
| 0005 |
| 0041 |
Is there any function I can do that?
0
I have the following structure:
|VALOR|
| 1 |
| 23 |
| 5 |
| 41 |
I have a need to transform:
| VALOR |
| 0001 |
| 0023 |
| 0005 |
| 0041 |
Is there any function I can do that?
2
If the field is char:
Select REPLICATE('0', 4 - LEN('23')) + RTrim('23')
2
You can use the FORMAT function.
SELECT FORMAT(valor, '000000') FROM tabela;
References:
Browser other questions tagged sql sql-server sql-server-2012
You are not signed in. Login or sign up in order to post.
FORMAT(value, '0000')
– anonimo