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)
 Nice and easy....

Author  Topic 

qman
Constraint Violating Yak Guru

442 Posts

Posted - 2008-01-15 : 11:23:46
Is it possible to perform a LIKE of the first 10 characters of a column? Say company_name?

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-01-15 : 11:42:05
you mean this?

where company_name like 'Microsoft C%'


Be One with the Optimizer
TG
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-01-15 : 11:53:00
left(comany_name, 10) like @search + '%'


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-16 : 01:34:49
quote:
Originally posted by qman

Is it possible to perform a LIKE of the first 10 characters of a column? Say company_name?


Obviously End result would be what TG's would return
Use his approach if you want to make use of index if defined on company_name

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -