Edit

Share via


SqlFunctions.PatIndex(String, String) Method

Definition

Returns the starting position of the first occurrence of a pattern in a specified expression, or zeros if the pattern is not found, on all valid text and character data types.

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)

Parameters

stringPattern
String

A string pattern to search for.

target
String

The string to search.

Returns

The starting character position where the string pattern was found.

Attributes

Remarks

You cannot call this function directly. This function can only appear within a LINQ to Entities query.

This function is translated to a corresponding function in the database. For information about the corresponding SQL Server function, see PATINDEX (Transact-SQL).

Applies to