1.獲取所有數據庫名:
SELECT Name FROM Master..SysDatabases ORDER BY Name
2.獲取所有表名:
SELECT Name FROM DatabaseName..SysObjects Where XType='U' ORDER BY Name
XType='U':表示所有用戶表;
XType='S':表示所有系統表;
3.獲取所有字段名:
SELECT Name FROM SysColumns WHERE id=Object_Id('TableName')