0
如何在整個數據庫上執行Microsoft SQL查詢,以便僅使用每個表的前5行?自動化:跟蹤已建立的MS SQL數據庫。 (All Tables,Col Headers)
這會給我一個很好的概述整個模式。(我希望)我試着數據庫圖很慢,你只能看到表和標題。我一直在手動完成這項任務,這也是永遠的。
最終,我想將數據導出爲excel或只是能夠查看結果。
例子輸出爲:
Table 1 - (Showing Column Headers and Actual Data)
ROW 1 Col1 Col2 Col3 Col4
ROW 2 Col1 Col2 Col3 Col4
ROW 3 Col1 Col2 Col3 Col4
ROW 4 Col1 Col2 Col3 Col4
ROW 5 Col1 Col2 Col3 Col4
Table 2 - (Showing Column Headers and Data)
ROW 1 Col1 Col2 Col3 Col4
ROW 2 Col1 Col2 Col3 Col4
ROW 3 Col1 Col2 Col3 Col4
ROW 4 Col1 Col2 Col3 Col4
ROW 5 Col1 Col2 Col3 Col4
我的SQL代碼:
SELECT TOP 5 *
FROM * TABLES
WHILE SELECTED < DATABASE
- 不知道如何從所有表說,然後收集並打印該重複像一個while循環,直到它運行整個數據庫。
非常感謝所有幫助。謝謝。