您好,请您先 登陆 或者 注册

我对客户商品名称进行批量修改请问助记码如何批量修改


提问者: yrlsoft
等级:普通会员
时间:2012-04-28 10:59
悬赏:10
解决时间:2012-04-28 23:18
最佳答案
--在查询分析器中执行下面语句:

create function GetPY(@str varchar(500))
returns VarChar(500)
as
begin
declare @cyc int,@length int,@str1 varchar(100),@charcate varbinary(20)
set @cyc=1--从第几个字开始取
set @length=len(@str)--输入汉字的长度
set @str1=''--用于存放返回值
while @cyc<=@length
begin
select @charcate=cast(substring(@str,@cyc,1) as varbinary)--每次取出一个字并将其转变成二进制,便于与GBK编码表进行比较
if @charcate>=0XB0A1 and @charcate<=0XB0C4
set @str1=@str1+'A'--说明此汉字的首字母为A,以下同上
else if @charcate>=0XB0C5 and @charcate<=0XB2C0
set @str1=@str1+'B'
else if @charcate>=0XB2C1 and @charcate<=0XB4ED
set @str1=@str1+'C'
else if @charcate>=0XB4EE and @charcate<=0XB6E9
set @str1=@str1+'D'
else if @charcate>=0XB6EA and @charcate<=0XB7A1
set @str1=@str1+'E'
else if @charcate>=0XB7A2 and @charcate<=0XB8C0
set @str1=@str1+'F'
else if @charcate>=0XB8C1 and @charcate<=0XB9FD
set @str1=@str1+'G'
else if @charcate>=0XB9FE and @charcate<=0XBBF6
set @str1=@str1+'H'
else if @charcate>=0XBBF7 and @charcate<=0XBFA5
set @str1=@str1+'J'
else if @charcate>=0XBFA6 and @charcate<=0XC0AB
set @str1=@str1+'K'
else if @charcate>=0XC0AC and @charcate<=0XC2E7
set @str1=@str1+'L'
else if @charcate>=0XC2E8 and @charcate<=0XC4C2
set @str1=@str1+'M'
else if @charcate>=0XC4C3 and @charcate<=0XC5B5
set @str1=@str1+'N'
else if @charcate>=0XC5B6 and @charcate<=0XC5BD
set @str1=@str1+'O'
else if @charcate>=0XC5BE and @charcate<=0XC6D9
set @str1=@str1+'P'
else if @charcate>=0XC6DA and @charcate<=0XC8BA
set @str1=@str1+'Q'
else if @charcate>=0XC8BB and @charcate<=0XC8F5
set @str1=@str1+'R'
else if @charcate>=0XC8F6 and @charcate<=0XCBF9
set @str1=@str1+'S'
else if @charcate>=0XCBFA and @charcate<=0XCDD9
set @str1=@str1+'T'
else if @charcate>=0XCDDA and @charcate<=0XCEF3
set @str1=@str1+'W'
else if @charcate>=0XCEF4 and @charcate<=0XD1B8
set @str1=@str1+'X'
else if @charcate>=0XD1B9 and @charcate<=0XD4D0
set @str1=@str1+'Y'
else if @charcate>=0XD4D1 and @charcate<=0XD7F9
set @str1=@str1+'Z'
set @cyc=@cyc+1--取出输入汉字的下一个字
End
return @str1--返回输入汉字的首字母
End


go

update t_cust_info set py_code = left(dbo.GetPY(cust_name),10)
回答者:ytkf007
等级:问不倒翁
时间:2012-04-28 11:08
您觉得最佳答案好不好?
目前有 0 个人评价
0% (0)
不好 100% (0)
提问者对最佳回答的评论:
非常好
对最佳答案的评论 共 1 条
学习了
评论者:55774883
其它回答 共 3 条
你要改成什么样,重新生成?见常用工具→工具大全→商品档案→重新生成助记码来操作。

赢通软件常用工具下载地址:
http://hao.yt-pos.com/cygj/ytcy/%E8%B5%A2%E9%80%9A%E8%BD%AF%E4%BB%B6%E5%B8%B8%E7%94%A8%E5%B7%A5%E5%85%B7.rar
回答者:李祥
等级:问不倒翁
时间:2012-04-28 11:08
学习。
回答者:zhaoshuai888
等级:问不倒翁
时间:2012-04-28 12:00
学习了
回答者:kh359
等级:问不倒翁
时间:2012-04-28 16:33
对最佳答案的评论:

评论字数200字以内
快到期问题
总积分排行
ytkf00720058 4704
kh35927124 3414
赢通技术43602 3117
bonchen13219 2797
赢通技术37615 2590
JCLH11087 1917
浅逝1873 1873
李祥19958 1542
xiaobird3309 1254
daoptt3310 1237