Finding all columns? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Finding all columns?

Hello,
How can I find all columns in a database? I am searching for relationships to a specific column. Thanks
J
Look in BOL: sp_columns
Luis Martin
Moderator
SQL-Server-Performance.com One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important
Bertrand Russell
All postings are provided “AS IS” with no warranties for accuracy.
Yes, I understand that one. I want to find all the columns in the database that have the same column. For example, which tables have the column Student_id. Thanks
J

USE Northwind
SELECT
TABLE_SCHEMA
, TABLE_NAME
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
COLUMN_NAME like ‘CustomerID’
AND
OBJECTPROPERTY(OBJECT_ID(table_name), ‘IsUserTable’) = 1
ORDER BY
COLUMN_NAME
Sorry, copy and paste mistake [:I]

Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)

Thank U !!
]]>