We can use either CHARINDEX or PATINDEX to search in TEXT field in SQL SERVER. The CHARINDEX and PATINDEX functions return the starting position of a pattern you specify.
Its usefull tips. You can use both the things whenever required.
Example of CHARINDEX:
Examples of PATINDEX:
USE LIMS;GOSELECT CHARINDEX('ensure', DocumentSummary)FROM SC_Workorder
WHERE DocumentID = 3;GOExamples of PATINDEX:
USE LIMS;GOSELECT PATINDEX('%ensure%',DocumentSummary)FROM SC_Workorder
WHERE DocumentID = 3;GO
No comments:
Post a Comment