October 25, 2013 at 6:14 am
Hi All,
How to Identify name starting with a specific letter without using like operator?
Please help me out.
Thanks in advance,
Sharmi
October 25, 2013 at 6:20 am
Why do you have the restriction of using the LIKE operator?
But you can accomplish this for example by using the LEFT or the SUBSTRING operator.
October 25, 2013 at 6:47 am
HanShi (10/25/2013)
Why do you have the restriction of using the LIKE operator?But you can accomplish this for example by using the LEFT or the SUBSTRING operator.
Bear in mind thet LEFT and SUBSTRING will not use any suitable indexes (possible performance issues) whereas LIKE will.
Far away is close at hand in the images of elsewhere.
Anon.
October 25, 2013 at 6:48 am
Could do something odd like this: -
WHERE Names = STUFF(Names,1,1,'A')
That'd tell you if the "Names" started with an A.
October 25, 2013 at 6:53 am
sharmili.net (10/25/2013)
Hi All,How to Identify name starting with a specific letter without using like operator?
Please help me out.
Why? That's what the LIKE operator is there for, refusing to use the tool most suitable to the problem is strange.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
October 25, 2013 at 10:26 am
sharmili.net (10/25/2013)
Hi All,How to Identify name starting with a specific letter without using like operator?
Please help me out.
Thanks in advance,
Sharmi
It depends... how slow do you want the code to actually run? 😀
I join Gail in asking, why would anyone want to do such a thing? The courtesy of a reply would be much appreciated.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 25, 2013 at 11:39 am
It sounds like a homework question to me. The lesson would be that, aside from the obvious approach, there's more than one way to accomplish something. In this case, hopefully eliminating the efficient solution will also be covered in the lesson.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply