我有几个内容表,我想用随机的文本段落来填在MS Word我可以简单地把它放在中间= rand()和presto放在一起!我得到了三段现成的文字。2 z _3 e3 o7 I: o( H8 V) l2 Y
是否可用于使用t-sql产生随机词典单词SQL脚本/命令? , e# v5 [2 T s( G6 \" k ! c! A5 b6 E5 m! J1 B5 M0 X" O 解决方案: ; L: c. Q9 |: e, q7 _ declare @Lorem nvarchar(max), @RowsToGen int, @Factor intselect @Lorem = 'Lorem ipsum dolor sit amet,consectetur adipisicing elit,sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,sunt in culpa qui officia deserunt mollit anim id est laborum.', @RowsToGen = 200-- strip punctuationsset @Lorem = replace(@Lorem,,set @Lorem = replace(@Lorem,'.,;withNum1(Pos) as( select cast(1 as int) union all select cast(Pos 1 as int) from Num1 where Pos < len(@Lorem)),Words as( select substring(@Lorem,Pos,charindex(' ',@Lorem Pos) - Pos) as Word from Num1 where Pos <= len(@Lorem) and substring(',' @Lorem,Pos,1) = ,WordsCnt(Factor) as( select @RowsToGen / count(*) 1 from Words),Num2(Pos) as( select cast(1 as int) union all select cast(Pos 1 as int) from Num2 cross join WordsCnt where Pos < WordsCnt. Factor)select top (@RowsToGen) Word from Num2 cross join Wordsorder by newid()option (maxrecursion 0)