DECLARE @ VARCHAR(10) = '7'; SELECT IIF(u IN(1,s),REPLI...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

DECLARE @ VARCHAR(10) = '7';


SELECT IIF(u IN(1,s),REPLICATE(s,s),s+REPLICATE(' ',s-2*LEN(s))+s)
FROM(SELECT @ s)z CROSS APPLY(SELECT TOP(s+0)ROW_NUMBER()OVER(ORDER BY 1/0)u FROM sys.messages)v

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results