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.

Formatting an IBAN Number in SQL Server

As you can see, we have formatted the IBAN number.

Good luck to everyone in business and life.

42 Views

Yavuz Selim Kart

I try to explain what I know in software and database. I am still improving myself by doing research on many programming languages. Apart from these, I am also interested in Graphic Design and Wordpress. I also have knowledge about SEO and Social media management. In short, I am a determined person who likes to work hard.

You may also like...

Don`t copy text!