找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

初学者课程:T3自学|T6自学|U8自学软件下载课件下载工具下载资料:通资料|U8资料|NC|培训|年结积分规则 | 使用常见问题Q&A
知识库:U8 | | NC | U9 | OA | 政务U8|U9|NCC|NC65|NC65客开|NCC客开新手必读 | 任务 | 快速增金币用友QQ群[微信群]
查看: 4105|回复: 3

[经验] SQL生成助记码

[复制链接]
发表于 2014-1-21 14:03:20 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册账号

×
某些时候对会计科目等基础档案生成助记码,网上有类似工具,但试试这个呢

  1. create function fun_getPY(@str nvarchar(4000))
  2. returns nvarchar(4000)
  3. as
  4. begin
  5. declare @word nchar(1),@PY nvarchar(4000)
  6. set @PY=''
  7. while len(@str)>0
  8. begin
  9. set @word=left(@str,1)
  10. --如果非汉字字符,返回原字符
  11. set @PY=@PY+(case when unicode(@word) between 19968 and 19968+20901
  12. then (select top 1 PY from (
  13. select 'A' as PY,N'驁' as word
  14. union all select 'B',N'簿'
  15. union all select 'C',N'錯'
  16. union all select 'D',N'鵽'
  17. union all select 'E',N'樲'
  18. union all select 'F',N'鰒'
  19. union all select 'G',N'腂'
  20. union all select 'H',N'夻'
  21. union all select 'J',N'攈'
  22. union all select 'K',N'穒'
  23. union all select 'L',N'鱳'
  24. union all select 'M',N'旀'
  25. union all select 'N',N'桛'
  26. union all select 'O',N'漚'
  27. union all select 'P',N'曝'
  28. union all select 'Q',N'囕'
  29. union all select 'R',N'鶸'
  30. union all select 'S',N'蜶'
  31. union all select 'T',N'籜'
  32. union all select 'W',N'鶩'
  33. union all select 'X',N'鑂'
  34. union all select 'Y',N'韻'
  35. union all select 'Z',N'咗'
  36. ) T
  37. where word>=@word collate Chinese_PRC_CS_AS_KS_WS
  38. order by PY ASC) else @word end)
  39. set @str=right(@str,len(@str)-1)
  40. end
  41. return @PY
  42. end
  43. go
复制代码
在UFDATA库添加上面的方法,随后
UPDATE CODE SET CHELP=DBO.FUN_GETPY(CCODE_NAME)

以上方法仅供参考,具体问题具体分析。
欢迎加入用友软件论坛千人群①:66742870

发表于 2014-1-21 17:58:33 | 显示全部楼层
膜拜V587C6的兔神
回复 点赞 拍砖

使用道具 举报

发表于 2016-4-7 14:44:15 | 显示全部楼层
膜拜V587C6的兔神

欢迎加入用友软件论坛千人群①:66742870
回复 点赞 拍砖

使用道具 举报

发表于 2022-10-27 13:33:14 | 显示全部楼层
可以自动胜场的啊  不因
回复 点赞 拍砖

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|站长微信|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号|51072502110008 )

GMT+8, 2024-5-17 18:15 , Processed in 0.025167 second(s), 8 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表