我有一个名为用户的表:
UserID UserName UserPwd
1 zhang 123456
2 li 455667
3 wang 332222
我想得到如下结果(UserID='1'):
tableName columnName columnDescribe columnValue
Users UserName The user name zhang
Users UserPwd The user password 123456
谁能帮我吗?
SELECT t.name AS [tableName],
c.name AS [columnName],
cd.value AS [columnDescribe]
FROM sysobjects t
INNER JOIN sysusers u
ON u.uid = t.uid
LEFT OUTER JOIN sys.extended_properties td
ON td.major_id = t.id
AND td.minor_id = 0
AND td.name = 'MS_Description'
INNER JOIN syscolumns c
ON c.id = t.id
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.type = 'u' AND t.name='Users'
ORDER BY t.name, c.colorder