|
Hi All, Can we use 'like' in case stetement as follows ??
(comments are locked)
|
|
Roshan, yes you can. Try this out:
(comments are locked)
|
|
Yes! Did you have trouble running it against table1? I knew I'd be too slow to answer this one! (+1)
Oct 27 '10 at 01:53 PM
Mark
I was striving for brevity!
Oct 27 '10 at 02:25 PM
KenJ
The query in the question was so good, I thought it was likely to have been run with issues before the question was asked.
Oct 27 '10 at 02:30 PM
KenJ
@roshan If William's answer helped you, I am sure it did, please upvote it and then mark it as accepted. Since you asked the question, you are the only one at this time who can accept it. The way to accept the answer is to click on the box next to the voting thumbs. Other users do not have this box visible, but you do, because this is your question. When you accept the answer, it will change background. This makes it easier for the people who browse through existing questions to find helpful answers quickly.
Oct 27 '10 at 03:02 PM
Oleg
(comments are locked)
|
|
...also the other way around I wouldn't use a case in the WHERE clause like this, the performance impact is terrible because this condition will cause a scan of some sort, tablescan, clustered index scan or index scan, depending on existing indexes. A seek (without a key lookup) is prefferred.
Oct 27 '10 at 11:35 PM
Håkan Winther
(comments are locked)
|


I think you deserve a [self learner] badge for that question