Reputation: 11972
Using SQL Server 2000
Table1
ID 001 0569 897 ....
ID Lenght should be 4, if the lenght is 3 then it should add '0' in front.
How to do this.
Need Query Help
Upvotes: 0
Views: 153
Reputation: 6578
See this link for two methods. Summarized:
SELECT RIGHT('0000' + CAST(ID AS VARCHAR(4)), 4) FROM Table1
Upvotes: 3