打印本文 打印本文 关闭窗口 关闭窗口
整理了一些t-sql技巧
作者:武汉SEO闵涛  文章来源:敏韬网  点击数16761  更新时间:2007/11/14 13:12:55  文章录入:mintao  责任编辑:mintao
@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、 获取指定索引的值的函数

create function getstrofindex (@str varchar(8000),@index int =0)
returns varchar(8000)
as
begin
  
declare @str_return varchar(8000)
  
declare @start int
  
declare @next int
  
declare @location int
  
select @start =1
  
select @next =1 --如果习惯从0开始则select @next =0
  select @location = charindex

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ...  下一页 >> 

打印本文 打印本文 关闭窗口 关闭窗口