sqlserver下提取汉字的sql语句,需要的朋友可以参考下。
代码如下:
-->Title:生成測試數據
-->Author:wufeng4552
-->Date :2009-09-21 09:02:08
if object_id('dbo.get_china_str')is not null drop function dbo.get_china_str
go
create function dbo.get_china_str
(
@str nvarchar(200)
)
returns nvarchar(200)
as
begin
declare @i int
set @i=1
while @ibegin
if len(unicode(substring(@str,@i,1)))begin
set @str=stuff(@str,@i,1,'');
end
else
set @i=@i+1;
end
return @str
end
go
select dbo.get_china_str(N'UNION ALL SELECT 我们都是中国人,都是炎黄子孙,都是龙人传人')
/*
我们都是中国人,都是炎黄子孙,都是龙人传人
(1 個資料列受到影響)
*/
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn