有没有什么简单的方法,可以分解一个字符串的。分解规则,字母,汉字,数字等可以分开 例如'string023汗a' 就分给4个变量 @a = 'string' @b = '023' @c = '汗' @d = 'a'
求一个简单高效的方法 ^_^
解决方案 »
- 求教:这一步在哪里做呀?(恢复数据库)
- 中秋佳节散分:100分,来者有分----上海薪水怎么样?WEB项目经理4000RMB?高了底了?
- if @@microsoftversion>0x07320000 这个版本是多少?
- 求语句的写法
- 要查询半个月前的数据,怎么写sql
- 求一个存储过程!
- 高手指教。这样的表如何写查询语句。。。
- 利用[入库明细表]累计修改[仓库存储数量主表]的入库数量,总是只有一行[入库明细表]的记录参与运算,怎么改比较方便?
- 已知每月第一天,求每月第二个星期二
- sql server 7.0与sql server 2000在 Bit型上不兼容
- 在sql 2000中求和问题
- 日期字段查询
set @str=N'string023汗a我1H你8'
declare @no int
set @no=1
declare @char char(1)
declare @if int
declare @output varchar(100)
while @no<=LEN(@str)
begin
set @if =@no
set @char= SUBSTRING(@str,@no,1)
while @char like '[a-z]'
begin
set @no=@no+1
select @char= SUBSTRING(@str,@no,1)
end
if @if<>@no
begin
select SUBSTRING(@str,@if,@no-@if)
set @if =@no
end
while (ISNUMERIC(@char)>0)
begin
set @no=@no+1
select @char= SUBSTRING(@str,@no,1)
end
if @if<>@no
begin
select SUBSTRING(@str,@if,@no-@if)
set @if =@no
end
while((ISNUMERIC(@char)<=0 )and(@char like '[^a-z]') and @no<=LEN(@str))
begin
set @no=@no+1
select @char= SUBSTRING(@str,@no,1)
end
if @if<>@no
begin
select SUBSTRING(@str,@if,@no-@if)
set @if =@no
end
end 可以分开数字、字母和汉字