﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Administering / SQL Server 2005  / Select Smart query / 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>Tue, 21 May 2013 20:48:23 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Select Smart query</title><link>http://www.sqlservercentral.com/Forums/Topic955314-146-1.aspx</link><description>Here are two options you could use:[code="sql"]--check for first name used as the first part of the last nameSELECT * FROM @tblWHERE LastName LIKE RTRIM(Fisrtname)+' %'-- check for a space in LastName (might produce false results, e.g. for Pietro de la Rosa ;-))SELECT * FROM @tblWHERE CHARINDEX(' ',LastName)&amp;gt;0[/code]</description><pubDate>Tue, 20 Jul 2010 12:30:03 GMT</pubDate><dc:creator>LutzM</dc:creator></item><item><title>RE: Select Smart query</title><link>http://www.sqlservercentral.com/Forums/Topic955314-146-1.aspx</link><description>you could do a charindex check for a blank space and make sure the number returned is greater than 0.  Make sure you trim your input though incase you have white space.I think you could also use like '% %' but that should probably be avoided for performance reasonsi would personally use charindex but would like to see what others say</description><pubDate>Tue, 20 Jul 2010 02:52:35 GMT</pubDate><dc:creator>Animal Magic</dc:creator></item><item><title>Select Smart query</title><link>http://www.sqlservercentral.com/Forums/Topic955314-146-1.aspx</link><description>Hello All,I looking for a very cleaver query I have a field LastName and by users mystake there are some that is having to names over that for E.g//FisrtName    LastnameRafael         Narezzi That is ok My problem is that I want a select to search for all users that is like thatFisrtname      LastNameRafael           Rafael Narezzihow could I do a select to get all users that have spaces between?Thanks</description><pubDate>Tue, 20 Jul 2010 00:42:31 GMT</pubDate><dc:creator>narezzi</dc:creator></item></channel></rss>