monkey_boys
monkey_boys

Reputation: 7348

how to search field name in table sql server2005

any software or source code can used?

Upvotes: 0

Views: 1982

Answers (3)

Remus Rusanu
Remus Rusanu

Reputation: 294387

Metadata about table structure is exposed in the Object Catalog Views:

select name from sys.columns where object_id = object_id('myTable');

Upvotes: 0

Will
Will

Reputation:

I'm not positive what you're asking, but you can query the SysColumns table to search for field names across all tables.

SELECT obj.Name [TableName], col.Name [ColumnName]
  FROM SysColumns      AS col
 INNER JOIN SysObjects AS obj ON col.ID    = obj.ID
                             AND obj.XType = 'U'
 WHERE col.Name LIKE '%Price%'

Upvotes: 0

Kevin Boyd
Kevin Boyd

Reputation: 12379

use database_name

Sp_help table_name

This stored procedure gives all the details of column, their types, any indexes, any constraints, any identity columns and some good information for that particular table.

Second method:

select column_name ‘Column Name’, data_type ‘Data Type’, 

character_maximum_length ‘Maximum Length’ from 

information_schema.columns where table_name = ‘table_name’

You can visit here for more details.

Upvotes: 1

Related Questions