use master DECLARE @i char(999)='Tho' DECLARE @a int=3,@b...

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

use master
DECLARE @i char(999)='Tho'
DECLARE @a int=3,@b int=1

DECLARE @ varchar(max)=''

SELECT top 999 @+=substring(@i,number+1,1)
FROM spt_values
WHERE type='P'and number<@a*@b
ORDER BY newid()

WHILE-@b<1
SELECT @=stuff(@+' ',@b*@a+1,0,'#
#'),@b-=1
PRINT stuff(replicate('#',2+2*@a),2+@a,0,rtrim(@))

Enter Parameters

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