如何通過一個值查找到值所在的SQL數(shù)據(jù)庫表-創(chuàng)新互聯(lián)

declare @cloumns varchar(40) declare @tablename varchar(40) declare @str varchar(40) declare @counts int declare @sql nvarchar(2000) declare MyCursor Cursor For  Select a.name as Columns, b.name as TableName from syscolumns a,sysobjects b,systypes c  where a.id = b.id and b.type = 'U'  and a.xtype=c.xtype and c.name like '%char%' set @str='張三' Open MyCursor Fetch next From MyCursor Into @cloumns,@tablename While(@@Fetch_Status = 0) Begin  set @sql='select  @tmp_counts=count(*) from ' +@tablename+ ' where ' +@cloumns+' = ''' +@str+ '''' execute sp_executesql  @sql,N'@tmp_counts int out',@counts out  if @counts>0  begin  print '表名為:'+@tablename+',字段名為'+@cloumns  end Fetch next From MyCursor Into @cloumns,@tablename End Close MyCursor Deallocate MyCursor

成都創(chuàng)新互聯(lián)公司基于分布式IDC數(shù)據(jù)中心構建的平臺為眾多戶提供德陽機房托管 四川大帶寬租用 成都機柜租用 成都服務器租用。

另外有需要云服務器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

新聞名稱:如何通過一個值查找到值所在的SQL數(shù)據(jù)庫表-創(chuàng)新互聯(lián)
文章來源:http://muchs.cn/article32/dpshpc.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供全網(wǎng)營銷推廣網(wǎng)站設計公司、網(wǎng)站導航、商城網(wǎng)站、ChatGPT、App設計

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化