22,209
社区成员
发帖
与我相关
我的任务
分享
create table ascll(a varchar(10),b varchar(10))
insert ascll
select '30','48' union all
select '31','49' union all
select '32','50' union all
select '33','51' union all
select '34','52' union all
select '35','53' union all
select '36','54' union all
select '37','55' union all
select '38','56' union all
select '39','57' union all
select '41','65' union all
select '42','66'
create proc test
@info nvarchar(100)
as
begin
declare @value nvarchar(100)
declare @int int
set @value=''
set @int=1
while @int<(LEN(@info)-1)
begin
set @value=@value+char((select TOP 1 b from ascll where a=substring(@info,@int,2)))
set @int=@int+2
end
select @value
end
/*
exec test
@info='414231323334353637383920'
AB123456789
*/
create proc test
@info nvarchar(100)
as
begin
declare @value nvarchar(100)
declare @int int
set @value=''
set @int=0
while @int<LEN(@info)
begin
set @value=@value+char((select b from ascll where a=substring(@info,@int,2)))
set @int=@int+2
end
select @value
end
create table ascll(a varchar(10),b varchar(10))
如 a =41 b=65
create proc test
@info nvarchar(100)
as
begin
declare @value nvarchar(100)
declare @int int
set @value=''
set @int=0
while @int<LEN(@info)
begin
set @value=@value+(select b from ascll where a=substring(@info,@int,2))
set @int=@int+2
end
select @value
end
差不多就这样了 自己改改