You can try

SELECT RIGHT('00000' + CAST(number AS NVARCHAR), 5)

The result will be a string, not a number type.

Answer from bobs on Stack Overflow
🌐
MSSQLTips
mssqltips.com › home › sql format number with cast, convert and more
SQL Format Number with CAST, CONVERT and more
October 31, 2025 - Daniel also regularly speaks at SQL Servers conferences and blogs. MSSQLTips Awards: Author of the Year Contender – 2015-2018, 2022, 2023 | Champion (100+ tips) – 2018 ... SELECT FORMAT(5634.6334, ‘N’, ‘en-us’) AS ‘Number’ returns 5,634.63 (and not 5,634.6334) because the formatting string precision defaults to a scale of two.
🌐
W3Schools
w3schools.com › sql › func_sqlserver_format.asp
SQL Server FORMAT() Function
The FORMAT() function formats a value with the specified format (and an optional culture in SQL Server 2017). Use the FORMAT() function to format date/time values and number values.
🌐
Database Guide
database.guide › how-to-format-numbers-in-sql-server
How to Format Numbers in SQL Server
May 3, 2018 - A format string defines how the output should be formatted. ... In this case, I used N as the second argument. This is the standard numeric format specifier for Number. This particular format specifier (N) results in the output being formatted with integral and decimal digits, group separators, ...
🌐
Microsoft Learn
learn.microsoft.com › en-us › sql › t-sql › functions › format-transact-sql
FORMAT (Transact-SQL) - SQL Server | Microsoft Learn
The following example shows how to format large numbers with comma separators. SELECT FORMAT(1234567.89, 'N0') AS FormattedNumber; Here's the result set. ... This example uses the N format specifier. The N specifier is used for numeric values, and the number of decimal places can be adjusted by changing the format string (for example, N2 for two decimal places).
🌐
EDUCBA
educba.com › home › data science › data science tutorials › sql tutorial › sql to number format
SQL to Number Format | Conversion from a String Type to a Numeric Type
April 3, 2023 - ROUND: Rounds a numeric value to the specified length or precision. TRUNCATE: Removes decimal places from a numeric value. PARSE: You can convert a string representation of a number to a numeric value.
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
Find elsewhere
🌐
YouTube
youtube.com › watch
Converting numbers to strings in SQL Server: STR and FORMAT functions - YouTube
In this video, we will be looking at how to convert numbers to strings in SQL Server.My SQL Server Udemy courses are:70-461, 70-761 Querying Microsoft SQL Se...
Published   August 4, 2021
🌐
Sqlmatters
sqlmatters.com › Articles › Formatting a number with thousand separators.aspx
Formatting a number with thousand separators - SQLMatters
You might prefer to encapsulate this into a User Defined Function (UDF), though if performance is an issue a CLR should perform better. I will finish by pointing out that formatting numbers is something that should really be left to the presentation layer (e.g. Reporting Services or Excel) rather than SQL, which is probably why Microsoft hasn’t included the functionality to do this.
🌐
Snowflake Documentation
docs.snowflake.com › en › sql-reference › sql-format-models
SQL format models - Source: Snowflake Documentation
In Snowflake, SQL format models (that is, literals containing format strings) are used to specify how numeric values are converted to text strings and vice versa. As such, they can be specified as arguments in the TO_CHAR , TO_VARCHAR and TO_DECIMAL , TO_NUMBER , TO_NUMERIC conversion functions.
🌐
W3Schools
w3schools.com › sql › func_mysql_format.asp
MySQL FORMAT() Function
String Functions: Asc Chr Concat with & CurDir Format InStr InstrRev LCase Left Len LTrim Mid Replace Right RTrim Space Split Str StrComp StrConv StrReverse Trim UCase Numeric Functions: Abs Atn Avg Cos Count Exp Fix Format Int Max Min Randomize Rnd Round Sgn Sqr Sum Val Date Functions: Date DateAdd DateDiff DatePart DateSerial DateValue Day Format Hour Minute Month MonthName Now Second Time TimeSerial TimeValue Weekday WeekdayName Year Other Functions: CurrentUser Environ IsDate IsNull IsNumeric SQL Quick Ref
🌐
TechOnTheNet
techonthenet.com › oracle › functions › to_number.php
Oracle / PLSQL: TO_NUMBER Function
April 16, 2009 - Since the format_mask and nls_language parameters are optional, you can simply convert a text string to a numeric value as follows: TO_NUMBER('1210.73') Result: 1210.73 · Share on: SQL · Oracle / PLSQL · SQL Server · MySQL · MariaDB · PostgreSQL · SQLite · Excel ·
🌐
T-SQL Tutorial
tsql.info › sql › how-to-convert-string-to-numeric.php
How to convert String to Numeric in sql
How to convert String to Numeric in sql with cast and convert functions. Examples of coversion.
🌐
MSSQLTips
mssqltips.com › home › sql convert int to string
SQL Convert INT to String
May 28, 2025 - So, by default, we need to convert OrderQty which is numeric into a string to be able to concatenate the string with the number. To do that, we will try different methods. The following example shows how to use the SQL CAST function for an int ...
🌐
Oracle
docs.oracle.com › en › database › oracle › oracle-database › 19 › sqlrf › TO_NUMBER.html
TO_NUMBER
November 12, 2025 - expr can be any expression that evaluates to a character string of type CHAR, VARCHAR2, NCHAR, or NVARCHAR2, a numeric value of type NUMBER, BINARY_FLOAT, or BINARY_DOUBLE, or null. If expr is NUMBER, then the function returns expr. If expr evaluates to null, then the function returns null. Otherwise, the function converts expr to a NUMBER value. If you specify an expr of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type, then you can optionally specify the format model fmt.