共用方式為


SqlFunctions.PatIndex(String, String) 方法

定義

傳回指定之運算式中的模式,在所有有效文字和字元資料類型中第一次出現的起始位置,如果找不到模式,便傳回零。

public:
 static Nullable<int> PatIndex(System::String ^ stringPattern, System::String ^ target);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "PATINDEX")]
public static int? PatIndex(string stringPattern, string target);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "PATINDEX")>]
static member PatIndex : string * string -> Nullable<int>
Public Shared Function PatIndex (stringPattern As String, target As String) As Nullable(Of Integer)

參數

stringPattern
String

要搜尋的字串模式。

target
String

要搜尋的字串。

傳回

找到字串模式的起始字元位置。

屬性

備註

您無法直接呼叫此函式。 此函式只能出現在 LINQ to Entities 查詢內。

此函式會轉譯為資料庫中的對應函式。 如需對應 SQL Server 函式的相關信息,請參閱 PATINDEX (Transact-SQL)

適用於