您好我不想使用我找到的查询来选择特定的表。我可以用它来选择所有表格但不想使用查询来选择一些表格。 我正在使用此查询:
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
我不知道该怎么办。
答案 0 :(得分:1)
添加WHERE
子句以限制您获得的内容,这只是标准SQL
答案 1 :(得分:1)
添加了where子句,如果需要,可以更改where子句参数。
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
您可以使用的另一个查询:
SELECT distinct TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE '%your table%'