日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

如何獲取SqlServer2005數(shù)據(jù)庫表結(jié)構(gòu)_Mssql數(shù)據(jù)庫教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:如何在SQL Server2005中還原數(shù)據(jù)庫
對于在SQL Server2000中的還原數(shù)據(jù)庫,很多朋友都是使用過的,一起來也很簡單,選擇文件后,選擇強制還原,問題即可解決,然而在2005中卻不行了,原因是:2005中數(shù)據(jù)庫的備份中記錄了備份數(shù)據(jù)庫的地址,在你還原的過程中,你必須將此地址換成你電腦上要還原

1.獲取表的基本字段屬性
--獲取SqlServer中表結(jié)構(gòu)
SELECT syscolumns.name,systypes.name,syscolumns.isnullable,
syscolumns.length
FROM syscolumns, systypes
WHERE syscolumns.xusertype = systypes.xusertype
AND syscolumns.id = object_id('你的表名')
運行效果

2.如果還想要獲取字段的描述信息則
--獲取SqlServer中表結(jié)構(gòu) 主鍵,及描述
declare @table_name as varchar(max)
set @table_name = '你的表名'
select sys.columns.name, sys.types.name, sys.columns.max_length, sys.columns.is_nullable,
(select count(*) from sys.identity_columns where sys.identity_columns.object_id = sys.columns.object_id and sys.columns.column_id = sys.identity_columns.column_id) as is_identity ,
(select value from sys.extended_properties where sys.extended_properties.major_id = sys.columns.object_id and sys.extended_properties.minor_id = sys.columns.column_id) as description
from sys.columns, sys.tables, sys.types where sys.columns.object_id = sys.tables.object_id and sys.columns.system_type_id=sys.types.system_type_id and sys.tables.name=@table_name order by sys.columns.column_id

 
運行效果

3.單獨查詢表的遞增字段
--單獨查詢表遞增字段
select [name] from syscolumns where
id=object_id(N'你的表名') and COLUMNPROPERTY(id,name,'IsIdentity')=1
運行效果

4.獲取表的主外鍵
--獲取表主外鍵約束
exec sp_helpconstraint '你的表名' ;

運行效果

 

分享:SQL Server2000安裝時出現(xiàn)錯誤及解決
安裝SQL Server 遇到錯誤提示: 以前的某個程序安裝已在安裝計算機上創(chuàng)建掛起的文件操作。運行安裝程序之前必須重新啟動計算機!。 打開注冊表編輯器,在HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession Manager 中找到 PendingFileRenameOperations

來源:模板無憂//所屬分類:Mssql數(shù)據(jù)庫教程/更新時間:2010-03-24
相關(guān)Mssql數(shù)據(jù)庫教程