<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Query to Find Column From All Tables of Database</title>
	<atom:link href="http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/</link>
	<description>SQL, SQL Server, MySQL, Big Data and NoSQL</description>
	<lastBuildDate>Thu, 20 Jun 2013 10:56:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Paul</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-501536</link>
		<dc:creator><![CDATA[Paul]]></dc:creator>
		<pubDate>Fri, 14 Jun 2013 12:07:49 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-501536</guid>
		<description><![CDATA[Pinal, Thanks for all the articles you produce. Like Paul above, I too look here first for help. Using your original script, I developed this to traverse all databases in an instance. I hope it helps someone out.

/************** Drop table if it exists **************************/
USE [MASTER]
If OBJECT_ID(&#039;PIITable&#039;,&#039;U&#039;) IS NOT NULL
DROP TABLE PIITABLE

/************** Create temp table in master **************************/

Create table PIITable(ID Int Identity (1,1),
Database_Name NVARCHAR(100),Table_Name NVARCHAR(100),SCHEMA_NAME NVARCHAR(20),
COLUMN_NAME NVARCHAR(100),Data_Type NVARCHAR(100))

/************** Create table variable to store database names **************************/
Declare @Databases table
(id int identity (1,1),DatabaseName nvarchar(100))

/************** Insert database names into table variable **************************/
Insert into @Databases

  SELECT  name [Database Name]
  FROM [model].[sys].[databases]
  where (database_id &gt; 4 and Name Not In(&#039;Distribution&#039;))
  order by name

--select * from @Databases --Select all databases from table variable (For testing only)


/***************************** Set up variables for loop **********************/

Declare @row int
Declare @rows int
Declare @database_name Nvarchar(MAX)
Declare @Execdatabase Nvarchar(MAX)

/***************************** Set up loop execution *****************************/
Select @rows = (Select MAX(id) from @Databases)
Set @row = 1

While @row &lt;= @rows
   Begin
      Set @database_name = (Select DatabaseName from @Databases where id = @row)   
     

Set @Execdatabase =
&#039;Use &#039;+ &#039; &#039;+ &#039;[&#039;+ @database_name +&#039;]&#039;+
&#039;Select (&#039;&#039;&#039;+  @database_name +&#039;&#039;&#039;)as Database_Name, t.name AS table_name , 
       SCHEMA_NAME( t.schema_id
                  )AS schema_name , c.name AS column_name,sys.types.name Data_Type INTO ##PrePIITable
 FROM         sys.tables AS t INNER JOIN
                      sys.columns AS c ON t.object_id = c.object_id INNER JOIN
                      sys.types ON c.system_type_id = sys.types.system_type_id
                      
  WHERE c.name IN( &#039;&#039;SSN&#039;&#039;, &#039;&#039;FirstName&#039;&#039; , &#039;&#039;LastName&#039;&#039; , &#039;&#039;First_Name&#039;&#039; ,&#039;&#039;Last_Name&#039;&#039; , &#039;&#039;MiddleName&#039;&#039;
                , &#039;&#039;Name_First&#039;&#039; , &#039;&#039;Name_Last&#039;&#039;
                 )
     OR c.name LIKE &#039;&#039;%Form%&#039;&#039; OR c.name LIKE &#039;&#039;%addr%&#039;&#039;

   GROUP BY t.name , 
           SCHEMA_NAME( t.schema_id
                      ) , c.name,sys.types.name
  ORDER BY schema_name , table_name; &#039;
  
 /***************** Execute above script **************************/
  exec (@Execdatabase)
  /********* Insert results into temporary Table (Master.dbo.PIITable) **************/ 
  INSERT INTO Master.dbo.PIITable
  Select * from ##PrePIITable
  
  /***************** Drop temp table for next itteration of loop **************************/ 
  If OBJECT_ID(&#039;tempdb..##PrePIITable&#039;,&#039;U&#039;) IS NOT NULL
  DROP TABLE ##PrePIITable
  
  Set @row = @row + 1 
   End
 /***************** Select entire result set from PIITable **************************/ 
  
  Select Serverproperty(&#039;Servername&#039;) as &#039;Server&#039;,
  Isnull(Serverproperty(&#039;Instancename&#039;),&#039;Default&#039;)&#039;Instance_Name&#039;,
   database_Name,Table_Name,Schema_Name,Column_Name,Data_Type
  
   from master.dbo.PIITable
   Where Data_Type &#039;uniqueidentifier&#039;
    Group By database_Name,Table_Name,Schema_Name,Column_Name,Data_Type
     order by Database_Name
  
/***************** Select Database/table result set from PIITable *******************/

  Select Serverproperty(&#039;Servername&#039;) as &#039;Server&#039;,
  Isnull(Serverproperty(&#039;Instancename&#039;),&#039;Default&#039;)&#039;Instance_Name&#039;,
   database_Name,Table_Name,Schema_Name,Data_Type
   
  from master.dbo.PIITable
  Where Data_Type &#039;uniqueidentifier&#039;
   Group by database_name,Table_Name,Schema_Name,Data_Type
    order by Database_Name
  
  
/********************** Clean up temp table in master ************/
  USE [MASTER]
If OBJECT_ID(&#039;PIITable&#039;,&#039;U&#039;) IS NOT NULL
DROP TABLE PIITABLE]]></description>
		<content:encoded><![CDATA[<p>Pinal, Thanks for all the articles you produce. Like Paul above, I too look here first for help. Using your original script, I developed this to traverse all databases in an instance. I hope it helps someone out.</p>
<p>/************** Drop table if it exists **************************/<br />
USE [MASTER]<br />
If OBJECT_ID(&#8216;PIITable&#8217;,'U&#8217;) IS NOT NULL<br />
DROP TABLE PIITABLE</p>
<p>/************** Create temp table in master **************************/</p>
<p>Create table PIITable(ID Int Identity (1,1),<br />
Database_Name NVARCHAR(100),Table_Name NVARCHAR(100),SCHEMA_NAME NVARCHAR(20),<br />
COLUMN_NAME NVARCHAR(100),Data_Type NVARCHAR(100))</p>
<p>/************** Create table variable to store database names **************************/<br />
Declare @Databases table<br />
(id int identity (1,1),DatabaseName nvarchar(100))</p>
<p>/************** Insert database names into table variable **************************/<br />
Insert into @Databases</p>
<p>  SELECT  name [Database Name]<br />
  FROM [model].[sys].[databases]<br />
  where (database_id &gt; 4 and Name Not In(&#8216;Distribution&#8217;))<br />
  order by name</p>
<p>&#8211;select * from @Databases &#8211;Select all databases from table variable (For testing only)</p>
<p>/***************************** Set up variables for loop **********************/</p>
<p>Declare @row int<br />
Declare @rows int<br />
Declare @database_name Nvarchar(MAX)<br />
Declare @Execdatabase Nvarchar(MAX)</p>
<p>/***************************** Set up loop execution *****************************/<br />
Select @rows = (Select MAX(id) from @Databases)<br />
Set @row = 1</p>
<p>While @row &lt;= @rows<br />
   Begin<br />
      Set @database_name = (Select DatabaseName from @Databases where id = @row)   </p>
<p>Set @Execdatabase =<br />
&#039;Use &#039;+ &#039; &#039;+ &#039;[&#039;+ @database_name +&#039;]&#039;+<br />
&#039;Select (&#039;&#039;&#039;+  @database_name +&#039;&#039;&#039;)as Database_Name, t.name AS table_name ,<br />
       SCHEMA_NAME( t.schema_id<br />
                  )AS schema_name , c.name AS column_name,sys.types.name Data_Type INTO ##PrePIITable<br />
 FROM         sys.tables AS t INNER JOIN<br />
                      sys.columns AS c ON t.object_id = c.object_id INNER JOIN<br />
                      sys.types ON c.system_type_id = sys.types.system_type_id</p>
<p>  WHERE c.name IN( &#039;&#039;SSN&#039;&#039;, &#039;&#039;FirstName&#039;&#039; , &#039;&#039;LastName&#039;&#039; , &#039;&#039;First_Name&#039;&#039; ,&#039;&#039;Last_Name&#039;&#039; , &#039;&#039;MiddleName&#039;&#039;<br />
                , &#039;&#039;Name_First&#039;&#039; , &#039;&#039;Name_Last&#039;&#039;<br />
                 )<br />
     OR c.name LIKE &#039;&#039;%Form%&#039;&#039; OR c.name LIKE &#039;&#039;%addr%&#039;&#039;</p>
<p>   GROUP BY t.name ,<br />
           SCHEMA_NAME( t.schema_id<br />
                      ) , c.name,sys.types.name<br />
  ORDER BY schema_name , table_name; &#039;</p>
<p> /***************** Execute above script **************************/<br />
  exec (@Execdatabase)<br />
  /********* Insert results into temporary Table (Master.dbo.PIITable) **************/<br />
  INSERT INTO Master.dbo.PIITable<br />
  Select * from ##PrePIITable</p>
<p>  /***************** Drop temp table for next itteration of loop **************************/<br />
  If OBJECT_ID(&#039;tempdb..##PrePIITable&#039;,&#039;U&#039;) IS NOT NULL<br />
  DROP TABLE ##PrePIITable</p>
<p>  Set @row = @row + 1<br />
   End<br />
 /***************** Select entire result set from PIITable **************************/ </p>
<p>  Select Serverproperty(&#039;Servername&#039;) as &#039;Server&#039;,<br />
  Isnull(Serverproperty(&#039;Instancename&#039;),&#039;Default&#039;)&#039;Instance_Name&#039;,<br />
   database_Name,Table_Name,Schema_Name,Column_Name,Data_Type</p>
<p>   from master.dbo.PIITable<br />
   Where Data_Type &#8216;uniqueidentifier&#8217;<br />
    Group By database_Name,Table_Name,Schema_Name,Column_Name,Data_Type<br />
     order by Database_Name</p>
<p>/***************** Select Database/table result set from PIITable *******************/</p>
<p>  Select Serverproperty(&#8216;Servername&#8217;) as &#8216;Server&#8217;,<br />
  Isnull(Serverproperty(&#8216;Instancename&#8217;),&#8217;Default&#8217;)'Instance_Name&#8217;,<br />
   database_Name,Table_Name,Schema_Name,Data_Type</p>
<p>  from master.dbo.PIITable<br />
  Where Data_Type &#8216;uniqueidentifier&#8217;<br />
   Group by database_name,Table_Name,Schema_Name,Data_Type<br />
    order by Database_Name</p>
<p>/********************** Clean up temp table in master ************/<br />
  USE [MASTER]<br />
If OBJECT_ID(&#8216;PIITable&#8217;,'U&#8217;) IS NOT NULL<br />
DROP TABLE PIITABLE</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-490228</link>
		<dc:creator><![CDATA[Paul]]></dc:creator>
		<pubDate>Wed, 05 Jun 2013 20:21:01 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-490228</guid>
		<description><![CDATA[You rock Pinal. I always check your blogs first when I have SQL Server questions as your answers are always easy to understand and straight to the point.]]></description>
		<content:encoded><![CDATA[<p>You rock Pinal. I always check your blogs first when I have SQL Server questions as your answers are always easy to understand and straight to the point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-484874</link>
		<dc:creator><![CDATA[Steve]]></dc:creator>
		<pubDate>Wed, 29 May 2013 14:59:46 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-484874</guid>
		<description><![CDATA[Thank you.
The basic script has saved me from having to manually trawl through a 2GB database with over 500 tables.]]></description>
		<content:encoded><![CDATA[<p>Thank you.<br />
The basic script has saved me from having to manually trawl through a 2GB database with over 500 tables.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harish</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-481928</link>
		<dc:creator><![CDATA[Harish]]></dc:creator>
		<pubDate>Fri, 24 May 2013 14:27:17 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-481928</guid>
		<description><![CDATA[Hi Pinal - I&#039;m looking for a query which will return me database name, table name, column name for a search value. e.g. I want to search for a value = &quot;test rating&quot; across all tables in the database.

I have some queries, but they return values for only user created tables and not system tables or tables created by an asp.net web application for instance. Any help is appreciated!]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal &#8211; I&#8217;m looking for a query which will return me database name, table name, column name for a search value. e.g. I want to search for a value = &#8220;test rating&#8221; across all tables in the database.</p>
<p>I have some queries, but they return values for only user created tables and not system tables or tables created by an asp.net web application for instance. Any help is appreciated!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danish</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-479174</link>
		<dc:creator><![CDATA[Danish]]></dc:creator>
		<pubDate>Mon, 20 May 2013 15:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-479174</guid>
		<description><![CDATA[Thanks @ Pushpa. In general the suggestions are really good on this site. I am a new SQL stored proc guy and trying to learn the whole logic around stored proc. 

I would love to connect with any of you on LinkedIn. Send me an email request at DanishJaff. I am using Gmail.

Thank You.
Danish]]></description>
		<content:encoded><![CDATA[<p>Thanks @ Pushpa. In general the suggestions are really good on this site. I am a new SQL stored proc guy and trying to learn the whole logic around stored proc. </p>
<p>I would love to connect with any of you on LinkedIn. Send me an email request at DanishJaff. I am using Gmail.</p>
<p>Thank You.<br />
Danish</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danish</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-479163</link>
		<dc:creator><![CDATA[Danish]]></dc:creator>
		<pubDate>Mon, 20 May 2013 15:05:08 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-479163</guid>
		<description><![CDATA[Thanks!]]></description>
		<content:encoded><![CDATA[<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pratik Aggarwal</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-477121</link>
		<dc:creator><![CDATA[Pratik Aggarwal]]></dc:creator>
		<pubDate>Fri, 17 May 2013 12:31:14 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-477121</guid>
		<description><![CDATA[how to find all the tables in a database which contains a column referenced from a particular table in the databse?]]></description>
		<content:encoded><![CDATA[<p>how to find all the tables in a database which contains a column referenced from a particular table in the databse?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kranti</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-472528</link>
		<dc:creator><![CDATA[kranti]]></dc:creator>
		<pubDate>Fri, 10 May 2013 08:22:55 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-472528</guid>
		<description><![CDATA[This is showing only column name not showing data ??

DECLARE @column_name varchar(20)
set @column_name = (SELECT top 1 column_name
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = &#039;bb_match&#039;)
select * from bb_match
where @column_name = &#039;8&#039;

how can show data or this record  ???]]></description>
		<content:encoded><![CDATA[<p>This is showing only column name not showing data ??</p>
<p>DECLARE @column_name varchar(20)<br />
set @column_name = (SELECT top 1 column_name<br />
FROM INFORMATION_SCHEMA.COLUMNS<br />
WHERE table_name = &#8216;bb_match&#8217;)<br />
select * from bb_match<br />
where @column_name = &#8217;8&#8242;</p>
<p>how can show data or this record  ???</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kranti</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-472499</link>
		<dc:creator><![CDATA[kranti]]></dc:creator>
		<pubDate>Fri, 10 May 2013 07:33:42 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-472499</guid>
		<description><![CDATA[DECLARE @column_name varchar(20)
@column_name = SELECT top 1 column_name
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = &#039;bb_match&#039;

select * from bb_match 
where @column_name = 6

this is not working ..where is mistake ???]]></description>
		<content:encoded><![CDATA[<p>DECLARE @column_name varchar(20)<br />
@column_name = SELECT top 1 column_name<br />
FROM INFORMATION_SCHEMA.COLUMNS<br />
WHERE table_name = &#8216;bb_match&#8217;</p>
<p>select * from bb_match<br />
where @column_name = 6</p>
<p>this is not working ..where is mistake ???</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kranti</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-472485</link>
		<dc:creator><![CDATA[kranti]]></dc:creator>
		<pubDate>Fri, 10 May 2013 06:56:16 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-472485</guid>
		<description><![CDATA[I have table name as @Table_Name
How can I get 1st Column Name from MyTable(@Table_Name) without knowing Column  name ..??]]></description>
		<content:encoded><![CDATA[<p>I have table name as @Table_Name<br />
How can I get 1st Column Name from MyTable(@Table_Name) without knowing Column  name ..??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kranti</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-472465</link>
		<dc:creator><![CDATA[kranti]]></dc:creator>
		<pubDate>Fri, 10 May 2013 06:18:15 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-472465</guid>
		<description><![CDATA[I have table name as @Table_Name
I have column value as @Value but dont have Column name ( but that exist at 1st position )

how can I compare that table column name value ?

I want something like 

SELECT * FROM @Table_Name
WHERE Table.Column[1].Value = @Value

How can I do that ......]]></description>
		<content:encoded><![CDATA[<p>I have table name as @Table_Name<br />
I have column value as @Value but dont have Column name ( but that exist at 1st position )</p>
<p>how can I compare that table column name value ?</p>
<p>I want something like </p>
<p>SELECT * FROM @Table_Name<br />
WHERE Table.Column[1].Value = @Value</p>
<p>How can I do that &#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: scoyne</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-470186</link>
		<dc:creator><![CDATA[scoyne]]></dc:creator>
		<pubDate>Mon, 06 May 2013 20:04:53 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-470186</guid>
		<description><![CDATA[just saved me a ton of time, thanks!]]></description>
		<content:encoded><![CDATA[<p>just saved me a ton of time, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pathak trilok</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-452416</link>
		<dc:creator><![CDATA[pathak trilok]]></dc:creator>
		<pubDate>Tue, 09 Apr 2013 10:17:18 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-452416</guid>
		<description><![CDATA[sir how to find the list of tables on which insert statement is fired means on which data is inserted date wise
????]]></description>
		<content:encoded><![CDATA[<p>sir how to find the list of tables on which insert statement is fired means on which data is inserted date wise<br />
????</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vin</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-430420</link>
		<dc:creator><![CDATA[vin]]></dc:creator>
		<pubDate>Sat, 02 Mar 2013 16:10:23 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-430420</guid>
		<description><![CDATA[how to display queried data in vb.net 2010?]]></description>
		<content:encoded><![CDATA[<p>how to display queried data in vb.net 2010?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-429822</link>
		<dc:creator><![CDATA[James]]></dc:creator>
		<pubDate>Fri, 01 Mar 2013 16:52:19 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-429822</guid>
		<description><![CDATA[Awesome, saved me some time, this is just what I was looking for!  =)]]></description>
		<content:encoded><![CDATA[<p>Awesome, saved me some time, this is just what I was looking for!  =)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Moore</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-429380</link>
		<dc:creator><![CDATA[Matthew Moore]]></dc:creator>
		<pubDate>Thu, 28 Feb 2013 21:35:44 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-429380</guid>
		<description><![CDATA[Thanks for this, very helpful when working your way into an existing system that is not designed properly.]]></description>
		<content:encoded><![CDATA[<p>Thanks for this, very helpful when working your way into an existing system that is not designed properly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: faisal</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-425549</link>
		<dc:creator><![CDATA[faisal]]></dc:creator>
		<pubDate>Fri, 22 Feb 2013 06:24:11 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-425549</guid>
		<description><![CDATA[dear all

is it possible to get all columns from a table except some specific one like::

select * from table where column_name  column_name ;

i need to retrieve 8 columns out of 10 from a table]]></description>
		<content:encoded><![CDATA[<p>dear all</p>
<p>is it possible to get all columns from a table except some specific one like::</p>
<p>select * from table where column_name  column_name ;</p>
<p>i need to retrieve 8 columns out of 10 from a table</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KuroZukami</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-414347</link>
		<dc:creator><![CDATA[KuroZukami]]></dc:creator>
		<pubDate>Tue, 29 Jan 2013 01:06:23 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-414347</guid>
		<description><![CDATA[this is what im looking for... THANKS!]]></description>
		<content:encoded><![CDATA[<p>this is what im looking for&#8230; THANKS!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nagarjunareddy</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-407923</link>
		<dc:creator><![CDATA[nagarjunareddy]]></dc:creator>
		<pubDate>Tue, 15 Jan 2013 08:24:59 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-407923</guid>
		<description><![CDATA[select * from INFORMATION_SCHEMA.tables

here u can get list of tables present in the database server....!!!]]></description>
		<content:encoded><![CDATA[<p>select * from INFORMATION_SCHEMA.tables</p>
<p>here u can get list of tables present in the database server&#8230;.!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GroovyNorCalGal</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-403716</link>
		<dc:creator><![CDATA[GroovyNorCalGal]]></dc:creator>
		<pubDate>Fri, 04 Jan 2013 17:20:44 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-403716</guid>
		<description><![CDATA[Awesome, exactly what I needed today. Thansk!]]></description>
		<content:encoded><![CDATA[<p>Awesome, exactly what I needed today. Thansk!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alkesh</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-402198</link>
		<dc:creator><![CDATA[Alkesh]]></dc:creator>
		<pubDate>Tue, 01 Jan 2013 08:40:18 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-402198</guid>
		<description><![CDATA[This  i belive consumers less query execution time..
select TABLE_NAME as &#039;table name&#039;, COLUMN_NAME as &#039;column name&#039; 
FROM INFORMATION_SCHEMA.COLUMNS
order by table_name]]></description>
		<content:encoded><![CDATA[<p>This  i belive consumers less query execution time..<br />
select TABLE_NAME as &#8216;table name&#8217;, COLUMN_NAME as &#8216;column name&#8217;<br />
FROM INFORMATION_SCHEMA.COLUMNS<br />
order by table_name</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: parth</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-392348</link>
		<dc:creator><![CDATA[parth]]></dc:creator>
		<pubDate>Thu, 13 Dec 2012 07:16:40 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-392348</guid>
		<description><![CDATA[pls help me to find out]]></description>
		<content:encoded><![CDATA[<p>pls help me to find out</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: parth</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-392347</link>
		<dc:creator><![CDATA[parth]]></dc:creator>
		<pubDate>Thu, 13 Dec 2012 07:15:42 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-392347</guid>
		<description><![CDATA[find-a-particular-text-from-all-tables-in-db]]></description>
		<content:encoded><![CDATA[<p>find-a-particular-text-from-all-tables-in-db</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Unais NI</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-361046</link>
		<dc:creator><![CDATA[Unais NI]]></dc:creator>
		<pubDate>Wed, 17 Oct 2012 07:47:52 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-361046</guid>
		<description><![CDATA[Thanks alot...!!!!]]></description>
		<content:encoded><![CDATA[<p>Thanks alot&#8230;!!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/#comment-358900</link>
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Thu, 11 Oct 2012 19:59:11 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=788#comment-358900</guid>
		<description><![CDATA[Sebas, I don&#039;t know if you have a solution or not, but I was doing this exact thing a few minutes ago.  This isn&#039;t the best, but it is quick and easy.  In my query below, you&#039;ll need to update the @Column value and @Value values.  Run the query into the &quot;Results as Text&quot; window.  Copy all of the IF EXISTS lines to a new query window and run it.  Enjoy!  John

DECLARE @Column VARCHAR(30) = &#039;BACHNUMB&#039;
DECLARE @Value VARCHAR(30) = &#039;&#039;&#039;12-09-20 B&#039;&#039;&#039;  -- Note the extra quotes (&#039;) because I&#039;m looking for character vaue.  &#039;10&#039; will work if you are looking for a number

SELECT		&#039;IF EXISTS(SELECT * FROM &#039; + sys.tables.name + &#039; WHERE &#039; + sys.columns.name + &#039; = &#039; + @Value + &#039;) BEGIN PRINT &#039;&#039;&#039; + sys.tables.name + &#039;&#039;&#039;; SELECT * FROM &#039; + 
				sys.tables.name + &#039; WHERE &#039; + sys.columns.name + &#039; = &#039; + @Value + &#039; END&#039; AS table_name
FROM		sys.tables
JOIN		sys.columns ON sys.tables.OBJECT_ID = sys.columns.OBJECT_ID
WHERE		sys.columns.name LIKE @Column
ORDER BY	table_name;]]></description>
		<content:encoded><![CDATA[<p>Sebas, I don&#8217;t know if you have a solution or not, but I was doing this exact thing a few minutes ago.  This isn&#8217;t the best, but it is quick and easy.  In my query below, you&#8217;ll need to update the @Column value and @Value values.  Run the query into the &#8220;Results as Text&#8221; window.  Copy all of the IF EXISTS lines to a new query window and run it.  Enjoy!  John</p>
<p>DECLARE @Column VARCHAR(30) = &#8216;BACHNUMB&#8217;<br />
DECLARE @Value VARCHAR(30) = &#8221;&#8217;12-09-20 B&#8221;&#8217;  &#8212; Note the extra quotes (&#8216;) because I&#8217;m looking for character vaue.  &#8217;10&#8242; will work if you are looking for a number</p>
<p>SELECT		&#8216;IF EXISTS(SELECT * FROM &#8216; + sys.tables.name + &#8216; WHERE &#8216; + sys.columns.name + &#8216; = &#8216; + @Value + &#8216;) BEGIN PRINT &#8221;&#8217; + sys.tables.name + &#8221;&#8217;; SELECT * FROM &#8216; +<br />
				sys.tables.name + &#8216; WHERE &#8216; + sys.columns.name + &#8216; = &#8216; + @Value + &#8216; END&#8217; AS table_name<br />
FROM		sys.tables<br />
JOIN		sys.columns ON sys.tables.OBJECT_ID = sys.columns.OBJECT_ID<br />
WHERE		sys.columns.name LIKE @Column<br />
ORDER BY	table_name;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
