Formatting an IBAN Number in SQL Server
Hello everyone. In this article, I will give information about formatting an IBAN number in SQL Server.
In SQL Server, in some cases, you may want to format the IBAN number.
You can easily do this using the code below.
DECLARE @iban VARCHAR(50) = 'TR320010009999901234567890';
SELECT
CONCAT(SUBSTRING(@iban, 1, 2), ' ', SUBSTRING(@iban, 3, 4), ' ',
SUBSTRING(@iban, 7, 4), ' ', SUBSTRING(@iban, 11, 4), ' ',
SUBSTRING(@iban, 15, 4), ' ', SUBSTRING(@iban, 19, 4), ' ',
SUBSTRING(@iban, 23, 4)) AS 'Formatlı IBAN';
When you run the above query, you will see a result similar to the one below.
As you can see, we have formatted the IBAN number.
Good luck to everyone in business and life.