SyntaxFix
Write A Post
Hire A Developer
Questions
Solutions that use SUBSTRING and concatenation + are nearly independent of RDBMS. Here is a short solution that is specific to SQL Server:
SUBSTRING
+
declare @x int = 123456789 select stuff(stuff(@x, 4, 0, '-'), 8, 0, '-')