最近工作中遇到乙個需求,要對整個資料庫中每個表的每個字段進行條件查詢。最後寫了一段**,實現遍歷資料庫的所有表並對每個字段進行條件查詢。
下面的**檢查欄位的值是否包含"http://",是則記錄「表名欄位名」。
環境:sql server 2008
**:use [database]--database為目標資料庫名稱
declare @sql nvarchar(1000)--記錄操作執行語句
declare @tableid int
set @tableid=2147483647--最大int值
測試功能正常,但效能一般。對效能沒什麼研究,請大蝦賜教。
Oracle 備份整個資料庫 和 匯入整個資料庫
備份 exp使用者名稱 密碼 本地服務名 file 目標位址 exp user pwd file file.dmp owner youruser1 使用者名稱 owner a 要備份a使用者的資料 匯入 imp 使用者名稱 密碼 本地服務名 file 檔案的位置 ignore y ignore y的...
匯出oracle整個資料庫
1 將資料庫baitest完全匯出,使用者名稱system 密碼manager 匯出du到d daochu.dmp中zhi exp system manager test file d daochu.dmp full y 2 將資料庫dao中system使用者與sys使用者的表匯出 exp syst...
從整個資料庫進行搜尋的儲存過程
對整個資料庫全部表的字段進行文字查詢,返回的結果為欄位名 表名 出現的次數 create procedure search tablename strword varchar 50 as begin set nocount on create table result oid int not nul...