Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 LIKE lowercase

Author  Topic 

notmyrealname

98 Posts

Posted - 2009-05-22 : 14:49:19
Hi.

prt_Mark LIKE '[fs]b%'

This returns prt_Marks even if they start with uppercase such as FB1001 and SB1001. I only want to return lowercase such as fb1001 and sb1001. I've tried numerous things to no avail.

Could someone please let me know if this can be done?

Thanks.

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-05-22 : 15:02:11
There are several things you can do, but realize that SQL (by default) is case insensitive so fb1001 is the same as FB1001 is the same as Fb1001.. you get the picture.

You could apply a different COLLATION to your prt_Mark column and then compare, but that'd kill performance.

Not get to get nosy, but does the case make a difference?
Go to Top of Page

notmyrealname

98 Posts

Posted - 2009-05-22 : 15:13:16
quote:

Not get to get nosy, but does the case make a difference?



Mind your own business!

Just kidding.

FB1001 is a structural assembly (beam, column, etc...) and fb1001 is a bolt. Standard Steel Industry naming conventions. Uppercase prefixes represent main assemblies while lower case prefixes represent the parts that belong to the main assembly. I am showing a list of bolts and do not want the main assemblies (uppercase prefixes) to be included.

I have other means of filtering my list but i was just wondering if there was a way to indicate lower case in a LIKE clause.

Thanks for the feedback.
Go to Top of Page

waterduck
Aged Yak Warrior

982 Posts

Posted - 2009-05-22 : 21:57:16
i think got a thing call binary thingy...but im not sure how to use it...sry :(
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-23 : 10:53:37
quote:
Originally posted by notmyrealname

quote:

Not get to get nosy, but does the case make a difference?



Mind your own business!

Just kidding.

FB1001 is a structural assembly (beam, column, etc...) and fb1001 is a bolt. Standard Steel Industry naming conventions. Uppercase prefixes represent main assemblies while lower case prefixes represent the parts that belong to the main assembly. I am showing a list of bolts and do not want the main assemblies (uppercase prefixes) to be included.

I have other means of filtering my list but i was just wondering if there was a way to indicate lower case in a LIKE clause.

Thanks for the feedback.


see this

http://vyaskn.tripod.com/case_sensitive_search_in_sql_server.htm
Go to Top of Page
   

- Advertisement -