# Tuesday, November 24, 2009
« VS2010, ASP.NET 4.0 and Silverlight 4.0 ... | Main | Visual Studio 2010: Add an extra context... »

Sometimes you need to find out in which tables a certain column name exists. For example when you want to find out where it’s being used as a foreign key. Here’s a handy script to use in T-SQL.

SELECT OBJECT_NAME(object_id), * FROM sys.columns WHERE name = 'columnname'
This makes use of the OBJECT_NAME function in T-SQL which according to the documentation: Returns the database object name for schema-scoped objects.

Grz, Kris.

Tuesday, November 24, 2009 9:07:02 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [2]  |  Related posts:
Using a comma delimited string with id's as input parameter for a SQL query