select * from sys.tables
USE master;
GO
DECLARE @db varchar(60),@tablo varchar(60);
PRINT '-------- Tüm Veritabanları ve Tabloları --------';
DECLARE db_cursor CURSOR FOR
SELECT name FROM sys.databases
OPEN db_cursor;
FETCH NEXT FROM db_cursor
INTO @db;
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT ' ';
PRINT @db;
exec ('use '+@db)
declare tablo_cursor cursor for
SELECT name
FROM sys.tables
open tablo_cursor
fetch next from tablo_cursor into @tablo
while @@FETCH_STATUS=0
begin
print ' '+@tablo
fetch next from tablo_cursor into @tablo
end
close tablo_cursor
deallocate tablo_cursor
exec('use IlkDB')
FETCH NEXT FROM db_cursor
INTO @db;
END
CLOSE db_cursor;
DEALLOCATE db_cursor;