Vote count:
0
I am relatively new to PostgreSQL and I know how to pad a number with zeros to the left in SQL Server but I'm struggling to fugure this out in PostgreSQL.
If I have a number column where the maximum number of digits is 3 and the min is 1 but if its one digit it has two zeros to the left and if its 2 digits it has 1 e.g. 001, 058, 123.
In SQL Server I can use the following:
RIGHT('000' + cast([Column1] as varchar(3)), 3) as [Column2]
This does not exist in PostgreSQL. Any help would be appreicated.
asked 1 min ago
Padding zeros to the left in postgreSQL
Aucun commentaire:
Enregistrer un commentaire