They're joining to the systypes table to get the information they're looking for. If you look at that table though, there is exactly ONE xtype with multiple values. It's sysname. The sysname is basically an NVARCHAR field. You will need to add a WHERE clause to your query and filter out WHERE systypes.name <> 'sysname' for your query to be correct. See the following results:SELECT st1.name, st1.xtype, st2.counterFROM systypes st1 INNER JOIN ( SELECT xtype, count(*) AS counter FROM systypes GROUP BY xtype HAVING COUNT(*)>1) st2 ON st1.xtype = st2.xtype
NOTE: You shouldn't be looking directly at the system tables at all. If you use the INFORMATION_SCHEMA views, you wouldn't get the duplicate issue you're now facing. Run the following:SELECT DISTINCT DATA_TYPEFROM INFORMATION_SCHEMA.COLUMNS ORDER BY DATA_TYPE
As you see, there are no duplicate data types in this table, because sysname isn't represented seperately.If you CREATE a table with sysname or VARCHAR and query systypes, it will show up as both nvarchar and sysname. If you query the views, it will only show up as nvarchar.USE NorthwindGOCREATE TABLE test_sysname(test sysname)GOSELECT DISTINCT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNSGOSELECT TABLE_NAME, COLUMN_NAME, DATA_TYPEFROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'test_sysname'GODROP TABLE test_sysnameGO
MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA.