查询数据库所有表
select table_name from information_schema.tables
查询数据库所有字段
select table_name from information_schema.columns
查询数据库所有视图
select table_name from information_schema.views
查询数据库所有表数据
DECLARE TableCursor SCROLL CURSOR FOR select table_name from information_schema.columns order by table_nameOPEN TableCursor DECLARE @TmpTableName Nvarchar(100); WHILE 1 = 1BEGIN FETCH NEXT FROM TableCursor INTO @TmpTableName If @@FETCH_STATUS != 0 BEGIN break End ELSE --print @TmpTableName BEGIN TRY exec('select * from ' + @TmpTableName ); END TRY BEGIN CATCH exec('select * from ' + @TmpTableName); END CATCH END CLOSE TableCursor DEALLOCATE TableCursor