I have this code:
select a.id as tableid,
a.name as tableName,
b.name as columnName,
b.status as columnStatus,
b.type as columnType
from sysobjects a
LEFT JOIN syscolumns b
ON a.id = b.id
WHERE a.name = 'table_name'
Now, the columType shows numbers. I want to get the name of the columnType, which resides in column 'name' in table 'systypes'. How do I do that? Simple LEFT JOIN will result in duplicate rows.