March 28, 2013 at 11:09 am
I am new to SQL Server and working on a new Data Base. I need to search the SQL Server database and list all Table names that have a Field I am looking for.
In Oracle I would do
SELECT column_name, Table_name FROM all_tab_columns
WHERE column_name = 'POS_TRANSACTION' ----Name_Of_Field from tables that I'm looking for
This will list all tables that have the field name.
How do I do this in SQL Server?
Thanks, Jim
March 28, 2013 at 11:15 am
SQL is very similar, and there's two ways:
select TABLE_NAME,COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where COLUMN_NAME='POS_TRANSACTION'
--or
select OBJECT_NAME(object_id) As TableName, name As ColumnName from sys.columns where name ='POS_TRANSACTION'
Lowell
March 28, 2013 at 11:28 am
It works great. Thank you for the quick reply.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply