av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

在SQLServer2005中使用正則表達(dá)式

CLR用戶定義函數(shù)只是在.NET 程序集中定義的靜態(tài)方法。CREATE FUNCTION 語句已擴(kuò)展為支持創(chuàng)建 CLR 用戶定義函數(shù)。

1、創(chuàng)建數(shù)據(jù)庫(kù)項(xiàng)目

2、添加用戶定義函數(shù)

以下是演示代碼:

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

// 示意代碼
public partial class UserDefinedFunctions
{
    public static readonly RegexOptions Options =

RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline;

    [Microsoft.SqlServer.Server.SqlFunction]
    public static string RegexValue(SqlChars input, SqlString pattern)
    {
        Regex regex = new Regex(pattern.Value, Options);

        return  regex.Match(new string(input.Value)).Value;
    }
}

3、將自定義函數(shù)關(guān)聯(lián)到數(shù)據(jù)庫(kù)

4、Sql 查詢分析器

為了確保SQL可以執(zhí)行托管代碼,執(zhí)行下面的語句:

EXEC sp_configure 'clr enabled', 1

sql 如下:
select dbo.RegexValue('2008-09-02',N'\d{4}') from Table

============================================= 

【編輯推薦】

  1. 深入淺出MySQL雙向復(fù)制技術(shù)
  2. 并行查詢讓SQL Server加速運(yùn)行
  3. SQL Server 2005常見問題淺析

新聞名稱:在SQLServer2005中使用正則表達(dá)式
分享網(wǎng)址:http://uogjgqi.cn/article/djjgeho.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們?cè)谖⑿派?4小時(shí)期待你的聲音

解答本文疑問/技術(shù)咨詢/運(yùn)營(yíng)咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流