We have an old SQL table that has been used by SQL Server 2000 for 10 years.
In it, our employee badge numbers are stored as char(6) from 000001 to 999999 .
Now I am writing a web application and I need to store employee badge numbers.
In my new table, I could make a short clipping and copy the old table, but I hope for better data transfer, smaller size, etc., just keeping int values โโfrom 1 to 999999 .
In C #, I can quickly format the int value for the icon number using
public static string GetBadgeString(int badgeNum) { return string.Format("{0:000000}", badgeNum);
How do I modify this simple SQL query to format the return value?
SELECT EmployeeID FROM dbo.RequestItems WHERE ID=0
If EmployeeID is 7135, this request should return 007135 .
sql sql-server tsql string-formatting
jp2code Mar 01 2018-12-01T00: 00Z
source share