ms sql 表 索引查询
SELECT OBJECT_NAME(IDX.object_id) Table_Name
, IDX.name Index_name
, PAR.rows NumOfRows
, IDX.type_desc TypeOfIndex
FROM sys.partitions PAR
INNER JOIN sys.indexes IDX ON PAR.object_id = IDX.object_id AND PAR.index_id = IDX.index_id AND IDX.type = 0
INNER JOIN sys.tables TBL
ON TBL.object_id = IDX.object_id and TBL.type ='U'
---列查找
SELECT name AS column_name , TYPE_NAME(system_type_id) AS column_type,OBJECT_NAME(object_id) FROM sys.columns WHERE system_type_id=165
--删除重复行
SELECT pk_billitem FROM fip_billitem GROUP BY pk_billitem HAVING COUNT(pk_billitem) > 1
delete from fip_billitem where pk_billitem='1001Z61000000000Udef' and attrcode='pk_group'