I know how to get the columns from a table using the following SQL statement:
SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE (TABLE_NAME = \'MYTA
Something like this:
Select col.name From
sys.objects obj
Join sys.columns col on col.[object_id] = obj.[object_id]
Join sys.index_columns idx_cols on idx_cols.[column_id] = col.[column_id] and idx_cols.[object_id] = col.[object_id]
Join sys.indexes idx on idx_cols.[index_id] = idx.[index_id] and idx.[object_id] = col.[object_id]
where obj.name = 'MYTABLENAME'
and idx.is_unique = 1