Database Simplified Headline Animator

Database Simplified

Monday, 7 November 2011

Find Tables With Column Name in SQL Server Databases

This post describes how one can find list of all the tables where a column with a particular name exists in a databases. Many people come across this issue and searches for query. So here is the query with example.

I am using following query to find out all the table having name “Status” in master database.



Use master
Go

Select B.name as TableName, A.name As ColumnName,C.name as DataType
from Sys.columns A
Join Sys.objects B On A.object_id=B.object_id
Join Sys.types C On A.system_type_id=C.system_type_id
Where A.name='Status'--ColumnName
Go

Output :

image

So the above query lists all the tables having column with name “status” and their datatype.

1 comment:

  1. In order to compensate for misplaced revenue in Illinois over the past decade, lawmakers expanded video gaming in 2019 by quantity of|numerous|a variety of} measures. Most notably, taxes on internet terminal income had been increased to 33%. Instead, the state fell brief, making just $1.four billion by the 메리트카지노 projected goal date. As Missouri wrestles with legalizing the spread of gaming machines, Illinois' experience has lessons good and bad.

    ReplyDelete