Printing Your Name as a Triangle in SQL Server
Hello to everyone,
In this article, I will talk about how you can print your name as a triangle in SQL Server.
In SQL Server, such examples will improve your algorithm logic.
You can easily do this by using the code below.
DECLARE @i INT,
@word VARCHAR(20);
SET @i = 0;
SET @word = 'YAVUZSELIMKART';
WHILE (@i < LEN(@word))
BEGIN
SET @i = @i + 1;
PRINT SUBSTRING(@word, 1, @i);
END;
When you run the code, you will get a result like the one below.
As you can see, your name is written in the form of a triangle.
Good luck to everyone in business and life.