SQL查询语句是SQL语句中非常重要的语句,下面就将为您介绍一个在SQL Server中查看某个表的字段信息的SQL查询语句,供您参考。
以下为在SQL Server中查看某个表的字段信息的SQL查询语句(以数据库Pubs的jobs表为例)
- SELECT SysObjects.Name as TableName,
- SysColumns.Name as ColumnsName,
- SysTypes.Name as DateType,
- SysColumns.Length as DateLength,
- SysProperties.Value as Remark --列描述
- FROM SysObjects,
- SysTypes,
- SysColumns
- LEFT JOIN SysProperties
- ON (Syscolumns.Id = Sysproperties.Id AND Syscolumns.Colid = Sysproperties.Smallid)
- WHERE (Sysobjects.Xtype ='u' OR Sysobjects.Xtype ='v')
- AND Sysobjects.Id = Syscolumns.Id
- AND SysTypes.XType = Syscolumns.XType
- AND SysTypes.Name <> 'sysname'
- AND SysObjects.name = 'jobs'
【编辑推荐】