日期:2014-05-18 浏览次数:20481 次
create function GetTown(@name nvarchar(max)) returns nvarchar(max) begin declare @i int set @i=2 set @name=substring(@name,1,charindex('镇',@name,1)) while @i<len(@name) if substring(reverse(@name),@i,1) like '[0-9]' or substring(reverse(@name),@i,1) like '[a-z]' or substring(reverse(@name),@i,1) = '市' return (@name) else set @name=stuff(...) ... ... ... end