摘要:
获取表主键1:SELECT TABLE_NAME,COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGEWHERE TABLE_NAME<>'dtproperties'2:EXEC sp_pkeys @table_name='表名'3:select o.name as 表名,c.name as 字段名,k.colid as 字段序号,k.keyno as 索引顺序,t.name as 类型 from sysindexes i join sysindexkeys k on i.id = k.id and 阅读全文