2009-08-13 44 views
0

任何軟件或源代碼都可以使用?如何在表中搜索字段名sql server2005

  • 我有許多表我的數據庫超過200臺和我的老闆給了一些項目和要求 和表中未提供信息,但給現場的名字,我想找到的字段名 查詢一些條件,但我不「知道在表這個領域,我來解決其
+0

的SQL Server版本? 2000? 2005年? – 2009-08-14 05:07:11

+0

SQL Server 2005 – 2009-08-16 17:04:19

回答

1

使用數據庫名稱

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

方法二:

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

character_maximum_length ‘Maximum Length’ from 

information_schema.columns where table_name = ‘table_name’ 

您可以訪問here瞭解更多詳情。

0

我不是你正在問什麼,但你可以查詢SysColumns表來搜索所有表中的字段名稱。

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%' 
0

有關的元數據表結構暴露在Object Catalog Views

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