Case Sensitive Pattern Match

The number one problem in case sensitive pattern match is collation. Without casting the value into case sensitive collation, the pattern [a-z] is same as the pattern [a-zA-Z].

select school_name
    from school
    where school_name COLLATE Latin1_General_BIN like '%[a-z]%'

-- list of all collation
SELECT *
FROM ::fn_helpcollations()
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s