1# So you do not have to create a database with your role name
2
3psql -U Username DatabaseName
4
1# if your database is different as your login name you must add the database name
2psql -U Username DatabaseName
1If the field is already a string, this will work
2
3 SELECT RIGHT('000'+ISNULL(field,''),3)
4If you want nulls to show as '000'
5
6It might be an integer -- then you would want
7
8 SELECT RIGHT('000'+CAST(field AS VARCHAR(3)),3)