日期:2014-05-18 浏览次数:20516 次
比如有:字符串“<abc>12345678<abc>ACDEF<abc>ABD456<abc>BCDGE<abc>fg456”, 想以<abc>为界,拆分成5段: <abc>12345678 <abc>ACDEF <abc>ABD456 <abc>BCDGE <abc>fg456
declare @str varchar(500) set @str='<abc>12345678<abc>ACDEF<abc>ABD456<abc>BCDGE<abc>fg456' set @str=replace(@str,'<abc>',''' union all select ''<abc>')+'''' set @str= right(@str,len(@str)-11) exec(@str) /* ------------- <abc>12345678 <abc>ACDEF <abc>ABD456 <abc>BCDGE <abc>fg456