Character-Related Problems

This section demonstrates some of the aspects and challenges of working with character data. I’ll cover character-related problems, including pattern matching, parsing, and case sensitivity.

Pattern Matching

SQL Server has limited support for pattern matching through the LIKE predicate and PATINDEX function. There’s still no support for regular expressions in T-SQL. ANSI supports regular expressions through an operator called SIMILAR TO.

Regarding the optimization of LIKE expressions, to be able to use an index efficiently in SQL Server 2000 you had to use a constant at the beginning of the pattern–for example, LastName LIKE N′A%′. Note that the optimizer could decide to use an index even when the pattern started with a ...

Get Inside Microsoft® SQL Server™ 2005 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.