blog.Toby

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            130 隨筆 :: 2 文章 :: 150 評論 :: 0 Trackbacks
          create function f_GetPy(@str nvarchar(4000))
          returns nvarchar(4000)
          as
          begin
          declare @strlen int,@re nvarchar(4000)
          declare @t table(chr nchar(1) collate Chinese_PRC_CI_AS,letter nchar(1))
          insert into @t(chr,letter)
          ? select '吖','A' union all select '八','B' union all
          ? select '嚓','C' union all select '咑','D' union all
          ? select '妸','E' union all select '發','F' union all
          ? select '旮','G' union all select '鉿','H' union all
          ? select '丌','J' union all select '咔','K' union all
          ? select '垃','L' union all select '嘸','M' union all
          ? select '拏','N' union all select '噢','O' union all
          ? select '妑','P' union all select '七','Q' union all
          ? select '呥','R' union all select '仨','S' union all
          ? select '他','T' union all select '屲','W' union all
          ? select '夕','X' union all select '丫','Y' union all
          ? select '帀','Z'
          ? select @strlen=len(@str),@re=''
          ? while @strlen>0
          ? begin
          ??? select top 1 @re=letter+@re,@strlen=@strlen-1
          ????? from @t a where chr<=substring(@str,@strlen,1)
          ????? order by chr desc
          ??? if @@rowcount=0
          ????? select @re=substring(@str,@strlen,1)+@re,@strlen=@strlen-1
          ? end
          ? return(@re)
          end
          go

          同樣道理,可查得漢字全拼。

          利用選擇WINDOWS系統的開始—程序—附件—輸入法生成器,進入輸入法生成器窗口,使用鼠標點擊逆轉換的頁框,點擊打開文件按鈕,選中硬盤WINDOWS\SYSTEM文件夾下的WINPY.MB文件,在碼表原文件中輸入C:\WINPY.TXT,輸入完畢后點擊逆轉換,此時系統對全拼字典庫進行轉換,最后將生成一個純文本文件,利用這個純文本文件編寫一段小程序即可生成一個拼音字典查詢數據庫。

          現在微軟推出了Windows 2000,它是基于Windows NT內核制作的,相對來說穩定性得到了很大的提高。因此,許多人都選用Windows 2000,我們可以將Windows 2000光盤中的I386文件夾下的Expand.exe和Imegen.ex_文件拷貝到指定的文件夾下,再在DOS下打入Expand Imegen.ex_ Imegen.exe后,只要雙擊Imegen.exe文件后就可使用Windows 2000中的輸入法生成器程序

          參考:
          http://www.blog.ztlz.net/user1/1/archives/2005/1409.shtml
          --測試
          select dbo.f_GetPy('測試人員')

          posted on 2006-01-23 17:49 渠上月 閱讀(469) 評論(1)  編輯  收藏 所屬分類: sql (sqlServer)

          評論

          # re: 獲得漢字首字母 SQL 2007-06-18 17:42 呼呼
          你好,我現在也遇到了這個問題,如果有空的話,探討一下吧
          QQ:371368523  回復  更多評論
            

          主站蜘蛛池模板: 天镇县| 晋城| 旺苍县| 株洲县| 高碑店市| 胶南市| 车险| 阳曲县| 潼关县| 隆昌县| 诸城市| 宁国市| 宝山区| 吉林市| 高尔夫| 衡东县| 陕西省| 新巴尔虎右旗| 泰和县| 壶关县| 莆田市| 洛扎县| 连山| 通州区| 湘阴县| 永寿县| 文山县| 银川市| 府谷县| 哈巴河县| 盱眙县| 上犹县| 汝南县| 河源市| 南平市| 大安市| 游戏| 布拖县| 绍兴县| 黄石市| 曲周县|