有時,我們想看看在一個表中,那一列是自動增長列,其列名是什么,這可以通過查詢系統表syscolumns獲得,在查詢時只要指明要查詢的表名和約束類型即可,下面分別給出獲取自動增長列列名的兩個方法。
第一個方法:
select name from syscolumns
where id=object_id('Student') and status & 128 = 128
第二個方法:
select name from syscolumns where id=object_id('Student') and
COLUMNPROPERTY(id,name,'IsIdentity')=1
新聞熱點
疑難解答