select s.[name] + '.' + t.[name] as tablename from sys.tables as t,sys.schemas as s where t.schema_id = s.schema_id and s.[name] = @dbo order by tablename 获取指定架构下的所有表 SELECT ( then d.name else '' end) 表名, a.colorder 字段序号, a.name 字段名, ( then '√'else '
1.select 表中重复的字段 from 表名 group by 表中的重复的字段 HAVING count(表中的重复的字段)>1 举例说明 : 表名 : psp_cell_model 重复的字段名:mp_no select mp_no from psp_cell_model group by mp_no HAVING count(mp_no)>1; 举例2: select * from psp_cell_model where mp_no in( select mp_no