﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / Has to Be a Better Way / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sun, 19 May 2013 03:49:58 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Has to Be a Better Way</title><link>http://www.sqlservercentral.com/Forums/Topic1406074-392-1.aspx</link><description>[quote][b]ACinKC (1/15/2013)[/b][hr][quote][b]AndrewSQLDBA (1/11/2013)[/b][hr]It is like asking users to type in the state name where they list. Most will get the spelling correct. Some will not.[/quote]And there's no way to limit what they can type in?  Maybe change the text box to a combo to select a limited (validated) set of values?  I'd rather have someone select 'KS' rather than typing in 'Kan'.  Or 'OptA' rather than 'I think I have option A'...[/quote] Yes, this is the way to go: relatively simple change in the front-end.  Create a lookup table in SQL, validate from the front-end what was entered, fetch the value from the lookup table.</description><pubDate>Tue, 15 Jan 2013 18:58:22 GMT</pubDate><dc:creator>MyDoggieJessie</dc:creator></item><item><title>RE: Has to Be a Better Way</title><link>http://www.sqlservercentral.com/Forums/Topic1406074-392-1.aspx</link><description>[quote][b]AndrewSQLDBA (1/11/2013)[/b][hr]It is like asking users to type in the state name where they list. Most will get the spelling correct. Some will not.[/quote]And there's no way to limit what they can type in?  Maybe change the text box to a combo to select a limited (validated) set of values?  I'd rather have someone select 'KS' rather than typing in 'Kan'.  Or 'OptA' rather than 'I think I have option A'...</description><pubDate>Tue, 15 Jan 2013 09:37:48 GMT</pubDate><dc:creator>ACinKC</dc:creator></item><item><title>RE: Has to Be a Better Way</title><link>http://www.sqlservercentral.com/Forums/Topic1406074-392-1.aspx</link><description>[quote][b]anthony.green (1/11/2013)[/b][hr]Full text indexing would be an option using the contains clauseSELECT ..... FROM SomeTableWHERE CONTAINS(ColumnName, 'abc or def or ghi ....... ')[/quote] + 1</description><pubDate>Mon, 14 Jan 2013 02:34:17 GMT</pubDate><dc:creator>Bhuvnesh</dc:creator></item><item><title>RE: Has to Be a Better Way</title><link>http://www.sqlservercentral.com/Forums/Topic1406074-392-1.aspx</link><description>HI GailThis is just in there WHERE clause, just as shown in the example. Since no list tables are being used, all this data in this one column is coming in from a user entered front-end. It is like asking users to type in the state name where they list. Most will get the spelling correct. Some will not.Andrew SQLDBA</description><pubDate>Fri, 11 Jan 2013 11:25:49 GMT</pubDate><dc:creator>AndrewSQLDBA</dc:creator></item><item><title>RE: Has to Be a Better Way</title><link>http://www.sqlservercentral.com/Forums/Topic1406074-392-1.aspx</link><description>[quote][b]AndrewSQLDBA (1/11/2013)[/b][hr]I would like to get suggestions or advice on how I can re-write this to be so much better performing. Not having to seek the entire table all those times.[/quote]That will execute as a single table scan. None of those are SARGable, so no seeks possible.What's this supposed to do?</description><pubDate>Fri, 11 Jan 2013 09:26:21 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: Has to Be a Better Way</title><link>http://www.sqlservercentral.com/Forums/Topic1406074-392-1.aspx</link><description>[quote][b]AndrewSQLDBA[/b]I ran across this bunch of crap written by a DB2 programmer, trying to write SQL Server code. He does not understand SLQ Server at all[/quote]Andrew, I often have to deal with DB2 stuff that seems less efficient than what I would expect from a good SQL programmer.  However, DB2 and SQL Server are two different birds.  The best DB2 access path may be the worst SQL Server execution plan.  My advice, and this is coming from experience in working with mainframers, is to sit down with the guy who wrote that code, and determine why he wrote it that way.  It could be it was best for DB2, and he may not realize there is a difference.  You should compare the hows and whys of each platform, and make sure he understands the difference.  He very well could turn out to be a great SQL Server/DB2 person, and that is a valuable skill set.  That's just my two cents.</description><pubDate>Fri, 11 Jan 2013 08:40:27 GMT</pubDate><dc:creator>Greg Snidow</dc:creator></item><item><title>RE: Has to Be a Better Way</title><link>http://www.sqlservercentral.com/Forums/Topic1406074-392-1.aspx</link><description>Full text indexing would be an option using the contains clauseSELECT ..... FROM SomeTableWHERE CONTAINS(ColumnName, 'abc or def or ghi ....... ')</description><pubDate>Fri, 11 Jan 2013 08:29:22 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>Has to Be a Better Way</title><link>http://www.sqlservercentral.com/Forums/Topic1406074-392-1.aspx</link><description>Good Morning EveryoneI am performing a code review before sending any thing into QA and on up. I ran across this bunch of crap written by a DB2 programmer, trying to write SQL Server code. He does not understand SLQ Server at all.I am thinking there has to be a much better way to write this mess:[code="sql"]WHERE	 (&amp;lt;ColumnName&amp;gt; LIKE '%abc%') 						OR         (&amp;lt;ColumnName&amp;gt; LIKE '%def%')						OR         (&amp;lt;ColumnName&amp;gt; LIKE '%ghi%')						OR         (&amp;lt;ColumnName&amp;gt; LIKE '%jkl%')						OR         (&amp;lt;ColumnName&amp;gt; LIKE '%mno%')						OR	(&amp;lt;ColumnName&amp;gt; LIKE '%pqr%')						OR         (&amp;lt;ColumnName&amp;gt; LIKE '%stu%')						OR         (&amp;lt;ColumnName&amp;gt; LIKE '%vw%')						OR         (&amp;lt;ColumnName&amp;gt; LIKE '%xy%')						OR         (&amp;lt;ColumnName&amp;gt; LIKE '%z%')[/code][color=#FF0000]I am  not looking for a "column" named like %%[/color]It is simple syntax example using the &amp;lt;ColumnName&amp;gt; as a place holder for a ColumnName, what ever it may be. The name of the column is irrelevant I am seeing this in a couple queries this person has written.I would like to get suggestions or advice on how I can re-write this to be so much better performing. Not having to seek the entire table all those times. Thank you in advance for all your help, suggestions and advice.Andrew SQLDBA</description><pubDate>Fri, 11 Jan 2013 08:26:16 GMT</pubDate><dc:creator>AndrewSQLDBA</dc:creator></item></channel></rss>