Menu ▼



Posted By :
avatarmrkraju
Total Views : 502

Add leading zeros to number in SQL Server

The below query will pad leading zeros to number (integer).

SELECT RIGHT('0000'+CAST(numberField AS VARCHAR(4)),4)


Example
The below example will add padding zeros upto 4 digits.
sql add zeros to number






comments powered by Disqus


Search dotnetlearners.com