declare @str varchar(500), @i int, @n int, @l int, @j int, @len int set @str = '一心一意三心二意高深莫测风高月黑事在人为人杰地灵如花似玉千言万语言之有理' set @len = len(@str) select @i = 1,@n = 1,@l = 1, @j = 1 create table #tab (col varchar(10)) while @i <= @len begin while @n <= @len begin while @l <= @len begin while @j <= @len begin insert into #tab select substring(@str,@i,1) + substring(@str,@n,1) + substring(@str,@l,1) + substring(@str,@j,1) set @j = @j + 1 print substring(@str,@j,1) end set @l = @l + 1 set @j = 1 end set @n = @n + 1 set @l = 1 end set @i = @i + 1 select @n = 1 end select * from #tab drop table #tab
|