﻿<?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 7,2000 / T-SQL  / Search specific string in data in all tables / 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>Thu, 23 May 2013 13:48:22 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Search specific string in data in all tables</title><link>http://www.sqlservercentral.com/Forums/Topic419243-8-1.aspx</link><description>I got something similar which is just a plain query, not a tool or a sProc.[url=http://fullparam.wordpress.com/2012/09/07/fck-it-i-am-going-to-search-all-tables-all-collumns/][/url]</description><pubDate>Mon, 10 Dec 2012 10:54:54 GMT</pubDate><dc:creator>regeter</dc:creator></item><item><title>RE: Search specific string in data in all tables</title><link>http://www.sqlservercentral.com/Forums/Topic419243-8-1.aspx</link><description>Here is a tool you can try (Free). [url=http://www.sqlmgmt.com/ProductDetail.aspx?Id=101]http://www.sqlmgmt.com/ProductDetail.aspx?Id=101[/url]This tool helps you to search all columns of all tables in a database for a string keyword. In order to increase performance, it examines string type columns only in all tables to search for a given keyword.</description><pubDate>Mon, 13 Jun 2011 22:28:52 GMT</pubDate><dc:creator>edylee</dc:creator></item><item><title>RE: Search specific string in data in all tables</title><link>http://www.sqlservercentral.com/Forums/Topic419243-8-1.aspx</link><description>here's something i use, and i'm sure i'm stating the obvious and what you already did tog et back up and running, but you'd be best off doing a back up, restoring a previous database, and then compare corrupted vs production.there's no built in tool to test for sql injection, you;l need to go thru your code.CREATE PROCEDURE UGLYSEARCH -- EXEC UGLYSEARCH 'TEST'@SEARCHSTRING VARCHAR(50)ASSET NOCOUNT ONDECLARE @SQL      VARCHAR(500),@TABLENAME        VARCHAR(60),@COLUMNNAME       VARCHAR(60)CREATE TABLE #RESULTS(TBLNAME VARCHAR(60),COLNAME VARCHAR(60),SQL VARCHAR(600))SELECT   SYSOBJECTS.NAME AS TBLNAME,  SYSCOLUMNS.NAME AS COLNAME,  TYPE_NAME(SYSCOLUMNS.XTYPE) AS DATATYPE  INTO #FKFINDER    FROM SYSOBJECTS      INNER JOIN SYSCOLUMNS ON SYSOBJECTS.ID=SYSCOLUMNS.ID    WHERE SYSOBJECTS.XTYPE='U'    AND TYPE_NAME(SYSCOLUMNS.XTYPE) IN ('VARCHAR','NVARCHAR','CHAR','NCHAR')    ORDER BY TBLNAME,COLNAMEDECLARE C1 CURSOR FOR SELECT TBLNAME,COLNAME FROM #FKFINDER ORDER BY TBLNAME,COLNAMEOPEN C1FETCH NEXT FROM C1 INTO @TABLENAME,@COLUMNNAMEWHILE @@FETCH_STATUS &amp;lt;&amp;gt; -1    BEGIN        --SET @SQL = 'SELECT ''' + @TABLENAME + ''' AS TABLENAME,''' + @COLUMNNAME + ''' AS COLUMNNAME,* FROM ' + @TABLENAME + ' WHERE ' +  @COLUMNNAME + ' LIKE ''%' + @SEARCHSTRING + '%'''        SET @SQL = 'IF EXISTS(SELECT * FROM ' + @TABLENAME + ' WHERE ' +  @COLUMNNAME + ' LIKE ''%' + @SEARCHSTRING + '%'') INSERT INTO #RESULTS(TBLNAME,COLNAME,SQL) VALUES(''' + @TABLENAME + ''',''' +  @COLUMNNAME + ''','' SELECT * FROM  ' + @TABLENAME + '  WHERE ' + @COLUMNNAME + ' LIKE ''''' + @SEARCHSTRING + ''''' '') ;'        PRINT @SQL        EXEC (@SQL)FETCH NEXT FROM C1 INTO @TABLENAME,@COLUMNNAME    ENDCLOSE C1DEALLOCATE C1SELECT * FROM #RESULTS</description><pubDate>Tue, 06 Nov 2007 13:35:22 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>RE: Search specific string in data in all tables</title><link>http://www.sqlservercentral.com/Forums/Topic419243-8-1.aspx</link><description>This one is useful link to search and replace SQL Server data in all columns of all tables, in a given database?http://vyaskn.tripod.com/sql_server_search_and_replace.htm:)</description><pubDate>Tue, 06 Nov 2007 12:55:23 GMT</pubDate><dc:creator>Venkataraman-408293</dc:creator></item><item><title>Search specific string in data in all tables</title><link>http://www.sqlservercentral.com/Forums/Topic419243-8-1.aspx</link><description>Hi Experts,Is there a way to find specific string in data in all the user tables, not column names or stored procedures? Can some one please help?  Also, one of our websites was hacked by someone.  I believe that they use SQL injection to do so.  Is there anyway/tool to check for SQL vulnerbilities?Any inputs will be very appreciated.Thanks,Minh</description><pubDate>Tue, 06 Nov 2007 12:26:58 GMT</pubDate><dc:creator>joemai</dc:creator></item></channel></rss>