sql server中表的介紹
1. 獲取表的基本字段屬性
獲取SqlServer中表結構 SELECT syscolumns.name,systypes.name,syscolumns.isnullable, syscolumns.length FROM syscolumns, systypes WHERE syscolumns.xusertype = systypes.xusertype AND syscolumns.id = object_id('你的表名')
運行效果
2.單獨查詢表的遞增字段
--單獨查詢表遞增字段 select [name] from syscolumns where id=object_id(N'你的表名') and COLUMNPROPERTY(id,name,'IsIdentity')=1
運行效果
3.獲取表的主外鍵
--獲取表主外鍵約束 exec sp_helpconstraint '你的表名' ;
運行效果
本文就為大家先介紹這三點,以后還會繼續為大家介紹更多的關于數據庫表的知識,希望對大家有所幫助。
【編輯推薦】