用SQL语句查询一个数据表所有字段的类型可以参考下面的代码:
SELECT
name AS column_name,TYPE_NAME(system_type_id) AS column_type,
max_length,is_nullable
FROM sys.columns
WHERE object_id=OBJECT_ID(N'Address')
扩展资料:
SQL语句
创建索引:create [unique] index idxname on tabname(col…。)
增加列:Alter table table_name add column_name column_type [default 默认值]--在表中增加一列,[]内的内容为可选项
删除索引:drop index idxname on tabname
参考资料来源:百度百科-结构化查询语言
oracle 的话,用PL/SQL Developer的话,邮件菜单中有个view选项,可以查看column的类型,限制条件,keys值
sql的话试下 desc [table name]
select a.name,b.name from sys.columns as a join sys.types as b
on a.system_type_id=b.system_type_id
where object_id=(select object_id from sys.tables where name='表的名字')
用exec sp_help '表名'
SELECT
name AS column_name,TYPE_NAME(system_type_id) AS column_type,
max_length,is_nullable
FROM sys.columns
WHERE object_id=OBJECT_ID(N'Address')