﻿<?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)  / Column Name / 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>Wed, 22 May 2013 17:09:53 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Column Name</title><link>http://www.sqlservercentral.com/Forums/Topic1392307-392-1.aspx</link><description>You can try the below however, this might take a long time depending on the number of records in the table.USE YOUR_DATABASE_NAMEGODECLARE @MY_COL VARCHAR(50)DECLARE @QRY VARCHAR (255)declare kursor cursor forSELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'YOUR_TABLE_NAME'OPEN kursorFETCH NEXT FROM kursor INTO @MY_COL   WHILE @@FETCH_STATUS = 0   BEGIN   SET @QRY= 'SELECT '+@MY_COL+' FROM YOUR_TABLE_NAME WHERE '+@MY_COL+' =''ABC'''PRINT @QRYEXEC (@QRY) FETCH NEXT FROM kursor INTO @MY_COL   END   CLOSE kursor   DEALLOCATE kursor </description><pubDate>Tue, 04 Dec 2012 03:09:30 GMT</pubDate><dc:creator>arunyadav007</dc:creator></item><item><title>Column Name</title><link>http://www.sqlservercentral.com/Forums/Topic1392307-392-1.aspx</link><description>Hi,I have table which have number of columns one of these columns contains value say 'ABC' I have to find the column name which contain ABC</description><pubDate>Tue, 04 Dec 2012 02:48:15 GMT</pubDate><dc:creator>kapil_kk</dc:creator></item></channel></rss>