-- 连接字符串 Data Source={0};Initial Catalog={1};User ID={2};Password={3} -- 获取所有数据库 USE MASTER SELECT NAME FROM SYSDATABASES WHERE SID != 1 ORDER BY NAME -- 获取所有表 SELECT * FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_NAME -- 获取指定表的所有字段 SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'XXXX' -- 获取所有存储过程 SELECT * FROM SYSOBJECTS WHERE TYPE = 'P'