--快速檢視表結構字段(比較全面的)
select
col.colorder
as 序號 ,case
when col.colorder =
1then
obj.name
else
''end
as 表名,''
as中文表名,
isnull(ep.[
value
], '') as
注釋 ,
col.name
as欄位名 ,
t.name
as資料型別 ,
col.length
as長度 ,
--isnull(columnproperty(col.id, col.name, 'scale'), 0) as 小數字數 ,
--case when columnproperty(col.id, col.name, 'isidentity') = 1 then '√'
--else ''
--end as 標識 ,
case
when
exists ( select
1from
dbo.sysindexes si
inner
join dbo.sysindexkeys sik on si.id =
sik.id
and si.indid =
sik.indid
inner
join dbo.syscolumns sc on sc.id =
sik.id
and sc.colid =
sik.colid
inner
join dbo.sysobjects so on so.name =
si.name
and so.xtype ='pk
'where sc.id =
col.id
and sc.colid = col.colid ) then'y
'else
''end
as主鍵,
col.colorder
as序號
--case when col.isnullable = 1 then 'y' else '' end as 允許空 ,
--isnull(comm.text, '') as 預設值
from
dbo.syscolumns col
left
join dbo.systypes t on col.xtype =
t.xusertype
inner
join dbo.sysobjects obj on col.id =
obj.id
and obj.xtype ='u
'and obj.status >=
0left
join dbo.syscomments comm on col.cdefault =
comm.id
left
join sys.extended_properties ep on col.id =
ep.major_id
and col.colid =
ep.minor_id
and ep.name =
'ms_description
'left
join sys.extended_properties eptwo on obj.id =
eptwo.major_id
and eptwo.minor_id =
0and eptwo.name =
'ms_description
'where obj.name =
'table'--
表名order
by col.colorder ;
sqlserver檢視表空間
sqlserver 用於檢視當前資料庫所有表占用空間大小的儲存過程 create procedure dbo.proc getsize asbegin create table temp t id intprimary keyidentity 1,1 t name sysname,表名 t rows...
表字段的處理 Sql Server
目錄 表的建立 建立約束 檢視約束 刪除約束 插入資料 增加字段 刪除字段 create table student 學號 char 8 not null,姓名 char 8 not null,性別 char 2 not null,出生日期 date default getdate 班級 char ...
Hive檢視表的分割槽字段
查詢某個表的分割槽資訊 show partitions employee 檢視某個表是否存在某個特定分割槽鍵 show partitionsemployee partition country us describe extendedemployee partition country us sho...