@Prog! - ASP.NET -
ASP.NET(C#) - AJAX, Silverlight - のメモ書き

SQLCLR EBCDIC (日本語カタカナ)に変換する

最新の投稿は、投稿日時: 10-26-2008 21:41 投稿者: Yu Asano です。スレッドには 1 件の返答があります。
  • 10-26-2008 21:41

    • Yu Asano
    • 貢献度トップ 10
    • 登録日 : 10-23-2008
    • Japan
    • 投稿数 239
    • ポイント 0

    SQLCLR EBCDIC (日本語カタカナ)に変換する

    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Data.SqlTypes;
    using Microsoft.SqlServer.Server;
    using System.Text;

    public partial class UserDefinedFunctions
    {
        /// <summary>
        /// 20290 IBM290 IBM EBCDIC (日本語カタカナ)
        /// </summary>
        /// <param name="target">文字列</param>
        /// <param name="length">文字数</param>
        /// <returns>byte[]</returns>
        [Microsoft.SqlServer.Server.SqlFunction]
        public static byte[] EBCDIC(string target, int length)
        {
            string wTarget = target.PadRight(length, ' ');

            Encoding encoding = Encoding.GetEncoding(20290);

            byte[] bytes = encoding.GetBytes(wTarget);
            return bytes;
        }
    };

    タグ:
    • 投稿ポイント: 0
  • 10-26-2008 21:41 回答元:

    • Yu Asano
    • 貢献度トップ 10
    • 登録日 : 10-23-2008
    • Japan
    • 投稿数 239
    • ポイント 0

    Re: SQLCLR EBCDIC (日本語カタカナ)に変換する

    SELECT dbo.EBCDIC(ItemNbr, 5) AS ItemNbr FROM table_1
    WHERE Key = @Key

    -- 0xF1F2F3F4F5

    • 投稿ポイント: 0
ページ 1 / 1 (2 アイテム) | RSS

momotchi.net
Powered by Community Server (Non-Commercial Edition), by Telligent Systems