@location<>0) begin select@start=@location+1 select@location=charindex('''','''',@str,@start) select@next=@next+1 end select@int_return=@next-2 return@int_return end
2、 获取指定索引的值的函数
createfunction getstrofindex (@strvarchar(8000),@indexint=0) returnsvarchar(8000) as begin declare@str_returnvarchar(8000) declare@startint declare@nextint declare@locationint select@start=1 select@next=1--如果习惯从0开始则select @next =0 select@location=charindex