Reputation: 37
Hi I wan't to select specific tables by using a query I found. I can use it to select all the tables but wan't to use the query to select a few . I'm using this query:
SELECT t.TABLE_SCHEMA AS [Parent],
t.TABLE_NAME AS [Object],
t.COLUMN_NAME AS [Type],
cd.value AS [Description]
FROM INFORMATION_SCHEMA.COLUMNS t
INNER JOIN syscolumns c
ON c.name = t.COLUMN_NAME
LEFT OUTER JOIN sys.extended_properties cd
ON cd.major_id = c.id
AND cd.minor_id = c.colid
AND cd.name = 'MS_Description'
ORDER BY t.TABLE_NAME, t.COLUMN_NAME
I'm not sure how to proceed.
Upvotes: 1
Views: 47
Reputation: 1864
Added where clause, you can change where clause parameter if you want.
SELECT t.TABLE_SCHEMA AS [Parent],
t.TABLE_NAME AS [Object],
t.COLUMN_NAME AS [Type],
cd.value AS [Description]
FROM INFORMATION_SCHEMA.COLUMNS t
INNER JOIN syscolumns c
ON c.name = t.COLUMN_NAME
LEFT OUTER JOIN sys.extended_properties cd
ON cd.major_id = c.id
AND cd.minor_id = c.colid
AND cd.name = 'MS_Description'
WHERE t.TABLE_NAME LIKE '%your search%'
ORDER BY t.TABLE_NAME, t.COLUMN_NAME
Another query you can use:
SELECT distinct TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE '%your table%'
Upvotes: 1
Reputation: 3724
Add a WHERE
clause to limit what you get back, this is just standard SQL
Upvotes: 1