--排列组合--执行方法:exec [Arrange] '1,2,3'--input:1,2,3--output:--1 --2 --3 --1,2 --1,3 --2,3 --1,2,3Create PROCEDURE [dbo].[Arrange]@input varchar(100)ASBEGINSET NOCOUNT ONif(len(@input)<1) returnDECLARE @tableArrange Table(id int identity(1,1),arrangeValue varchar(100),maxid int,lenOfValue int)declare @split varchar(10)set @split = ','declare @startIndex intset @startIndex = 1declare @endIndex intset @endIndex = charindex(@split,@input,@startIndex)declare @items varchar(100)while(@endIndex0)beginset @items = Substring(@input,@startIndex,@endIndex-@startIndex)if len(@items)>0insert into @tableArrang
...
继续阅读
(18)