The query below does not return expected results with SOME databases.
If I run the two queries separately I get the desired results.
Any idea what is wrong?
Cheers,
Julian
SELECT TABLE_SCHEMA, TABLE_NAME,
'[' + TABLE_SCHEMA + '].' + '[' + TABLE_NAME + ']' SchemaAndTable,
(
SELECT name IDColumn
FROM syscolumns
WHERE COLUMNPROPERTY(id, name, 'IsIdentity') = 1
AND TABLE_NAME = OBJECT_NAME (ID)
)
as IdColumn
FROM [WZH].INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'