Sql 批量查看字符所在的表及字段
更新時(shí)間:2009年07月22日 07:36:38 作者:
批量查看字符所在的表及字段的sql語(yǔ)句
復(fù)制代碼 代碼如下:
declare @str varchar(100)
set @str='8f8el3l'
declare @s varchar(8000)
declare tb cursor local for
select s='if exists(select 1 from ['+b.name+'] where ['+a.name+'] like ''%'+@str+'%'')
print ''所在的表及字段: ['+b.name+'].['+a.name+']'''
from syscolumns a join sysobjects b on a.id=b.id
where b.xtype='U' and a.status>=0
and a.xusertype in(175,239,231,167)
open tb
fetch next from tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch next from tb into @s
end
close tb
deallocate tb
相關(guān)文章
在SQL觸發(fā)器或存儲(chǔ)過(guò)程中獲取在程序登錄的用戶
每個(gè)用戶可以登錄系統(tǒng),在程序中操作數(shù)據(jù)(添加,更新和刪除)需要實(shí)現(xiàn)記錄操作跟蹤。是誰(shuí)添加,更新和刪除的,這些信息將會(huì)插入至AuditLog表中2012-01-01SQL處理多級(jí)分類,查詢結(jié)果呈樹形結(jié)構(gòu)
對(duì)于多級(jí)分類常規(guī)的處理方法,很多程序員可能是用程序先讀取一級(jí)分類記錄,然后通過(guò)一級(jí)分類循環(huán)讀取下面的子分類2012-08-08一個(gè)基于ROW_NUMBER()的通用分頁(yè)存儲(chǔ)過(guò)程代碼
項(xiàng)目中有很多小型的表(數(shù)據(jù)量不大),都需要實(shí)現(xiàn)分頁(yè)查詢,因此實(shí)現(xiàn)了一個(gè)通用的分頁(yè)。2010-10-10SQL Server存儲(chǔ)過(guò)程中編寫事務(wù)處理的方法小結(jié)
這篇文章主要介紹了SQL Server存儲(chǔ)過(guò)程中編寫事務(wù)處理的方法,結(jié)合實(shí)例形式總結(jié)分析了三種存儲(chǔ)過(guò)程中編寫事務(wù)處理的方法,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2016-03-03