Monday, 24 July 2017

Print Star in SQL SERVER

We can print the pyramid star in sql server also using sql server using below sql query.
;With CTE(star)
AS
(
SELECT CAST('*' as varchar(10)) as star
UNION ALL
SELECT CAST(star +'*' as varchar(10)) FROM CTE
WHERE LEN(star)<10
)
SELECT * FROM CTE

See the output

No comments:

Post a Comment

If you have any doubt, please let me know.

Popular Posts