We have a bunch of tables with an 'S_' prefix and I wanted to get the identity columns for them so I ran this:
It worked okay, but returned other rows with tables beginning with 'S' (e.g., SpecialAssets, Statuses, SubAccounts).
Any idea why 'S_%' didn't return just the rows with table names that started with 'S_' ?
< M!ke >
Code:
SELECT o.name AS [Table Name]
, c.name AS [Column Name]
FROM sysobjects o
JOIN syscolumns c
ON o.id = c.id
WHERE o.type = 'U'
AND COLUMNPROPERTY(o.id, c.name, 'IsIdentity') = 1
AND o.name LIKE 'S_%'
ORDER BY 1
It worked okay, but returned other rows with tables beginning with 'S' (e.g., SpecialAssets, Statuses, SubAccounts).
Any idea why 'S_%' didn't return just the rows with table names that started with 'S_' ?
< M!ke >