I am trying to get the COLUMN_NAME, DATA_TYPE using
我正在尝试使用COLUMN_NAME,DATA_TYPE
SELECT COLUMN_NAME, DATA_TYPE
FROM dbo.[CORDELACIUTAT Resource Time Registr_]
But I got this error:
但是我收到了这个错误:
Msg 207, Level 16, State 1.
Invalid column name 'COLUMN_NAME'.
Msg 207, Level 16, State 1.
Invalid column name 'DATA_TYPE'. (Line 1)消息207,级别16,状态1.列名称“COLUMN_NAME”无效。消息207,级别16,状态1.列名称“DATA_TYPE”无效。 (第1行)
2 个解决方案
#1
2
You should query information_schema.columns
view
您应该查询information_schema.columns视图
select column_name, data_type
from information_schema.columns
where table_name = 'CORDELACIUTAT Resource Time Registr_'
#2
0
You don't access that data directly from the table. Try this:
您不直接从表中访问该数据。尝试这个:
select COLUMN_NAME,DATA_TYPE from INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME =[CORDELACIUTAT Resource Time Registr_]
#1
2
You should query information_schema.columns
view
您应该查询information_schema.columns视图
select column_name, data_type
from information_schema.columns
where table_name = 'CORDELACIUTAT Resource Time Registr_'
#2
0
You don't access that data directly from the table. Try this:
您不直接从表中访问该数据。尝试这个:
select COLUMN_NAME,DATA_TYPE from INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME =[CORDELACIUTAT Resource Time Registr_]