去除字符串重复项:
declare @str varchar(8000) declare @ret varchar(8000),@return varchar(8000) select @str = 'APR-11,APR12,APR06,APR-11,APR12,APR06' select @str = @str+',' while charindex(',',@str) > 0 begin select @ret = substring(@str,1,charindex(',',@str)-1) select @return = isnull(@return+',','')+@ret select @str = replace(@str,@ret+',','') end select @return --------------------------- APR-11,APR12,APR06