好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識庫 > 游標刪除多個表里臟數據的方法

游標刪除多個表里臟數據的方法

熱門標簽:慶陽地圖標注 電銷外呼系統軟件功能 榕城市地圖標注 美團地圖標注商戶認證注冊 浙江穩定外呼系統供應商 北京400電話辦理多少錢 承德地圖標注公司名需要花錢嗎 咸陽電腦外呼系統運營商 怎么給高德做地圖標注

第一種方法:

復制代碼 代碼如下:

CREATE proc [dbo].[delAllRecord]
as
declare @tableName nvarchar(255)
declare @Sql nvarchar(255)

Declare curTable Cursor
        for select Table_Name from information_schema.tables where TABLE_TYPE='BASE TABLE'
Open curTable
Fetch Next From curTable Into @tableName

WHILE(@@FETCH_STATUS = 0)
        BEGIN
                set @Sql = N'delete from '+@tableName
                exec sp_executesql @sql
                Fetch Next From curTable Into @tableName
        end
CLOSE curTable
DEALLOCATE curTable


第二種方法:

復制代碼 代碼如下:


--declare test_cursor cursor scroll for

--select id,table_name from dbo.section_type

--open test_cursor

--declare @id int

--declare @table_name nvarchar(50)

--while @@fetch_status=0

--begin

--fetch next from test_cursor into @id,@table_name

--print @id

--print @table_name

--end

--close test_cursor

--deallocate test_cursor

 

--刪除projectrangtree的臟數據

delete from projectrangtree where deleteversion>0

delete from projectrangtree where type=3 and parentid not in(select id from projectrangtree where type=2)

delete from projectrangtree where type=4 and parentid not in(select id from projectrangtree where type=3)

delete from projectrangtree where type=5 and parentid not in(select id from projectrangtree where type=4)

 

--刪除section_settings的臟數據

delete from section_settings where parent_prj_tree_id not in(select id from projectrangtree)

 

--刪除各個表里的測點

declare @table_name varchar(50)

declare @sql nvarchar(500)--此處要注意,聲明的長度一定要夠

--declare @measuring_point_id nvarchar(500)

declare del_cursor cursor scroll for

select table_name from section_type

open del_cursor

fetch next from del_cursor into @table_name

--print @table_name

while (@@fetch_status=0)

begin

--print quotename(@table_name)

--set @measuring_point_id='select measuring_point_id from '+quotename(@table_name)

--exec sp_executesql @measuring_point_id

set @sql = 'delete from '+ quotename(@table_name) +' where measuring_point_id not in(select id from measuring_point_setting)'            

exec sp_executesql @sql

--delete from @table_name where measuring_point_id not in (select id from measuring_point_setting)

fetch next from del_cursor into @table_name

end

close del_cursor

deallocate del_cursor
 

--delete from (select talbe_name from section_type) where measuring_point_id not in (select id from measuring_point_setting)

您可能感興趣的文章:
  • SQL Server游標的使用/關閉/釋放/優化小結
  • SQL Server遍歷表中記錄的2種方法(使用表變量和游標)
  • sqlserver中觸發器+游標操作實現
  • 教你怎么使用sql游標實例分享
  • SQL server使用自定義函數以及游標
  • sql 游標使用筆記
  • SQL Server的通用分頁存儲過程 未使用游標,速度更快!
  • sqlserver 函數、存儲過程、游標與事務模板
  • MSSQL 游標使用 心得
  • sqlserver 游標的簡單示例
  • SQL Server 游標語句 聲明/打開/循環實例

標簽:新鄉 重慶 上海 昭通 呼和浩特 江蘇 貴州 拉薩

巨人網絡通訊聲明:本文標題《游標刪除多個表里臟數據的方法》,本文關鍵詞  游標,刪除,多個,表里,臟,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《游標刪除多個表里臟數據的方法》相關的同類信息!
  • 本頁收集關于游標刪除多個表里臟數據的方法的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 乳孔被撑开乳孔改造10p| 亚洲国产aⅴ精品一区二区| 国产清纯白嫩初高生在线观看| 女被C??视频网站| 日韩免费看片| 波多野结VS黑人无码| 国产精品免费视频一区二区| 秋霞影视免费观看视频| 亚洲va久久久久久久精品| 国产GV在线观看18???软件| 亚洲丰满熟妇XXXX性多毛| 国产AV无码亚洲AV毛片绿巨人 | 丰满双乳峰白嫩少妇www91| 美女张开腿黄网站免费国产| 啊~~嗯嗯嗯轻点揉捏h| 特级毛片WWW免费版| 亚洲另类xxxx| 久久影视| 任你日视频| 邻居好紧好爽再浪一点| 国产精品欧美日韩AV久久动漫| 欧美性猛交xxxxbbb| 啊?啊?啊?快?高潮了免费看 | 玉腿娇喘内裤乳峰蕾丝美女| 欧洲美女裸体XXXXX毛多小说| 日本人一进一出抽搐gif免费| 僵尸三片有哪些| 亚洲最新视频| 蜜桃911精品一区二区三区作者| 欧美成熟美妇乱| 李丽珍蜜桃成熟时电影3在线观看| 日本婬乱A片| 日日噜噜噜夜夜爽爽狠狠图片 | 美女色黄网站| 日本????XX高清丝袜| 偷玩男生大jiji秘?免费网站| 麻豆免费版在线观看| 秋霞韩国一级特黄大片| 9久在线视频精品免费观看| 日本四级片| 毛片免费视频无码播放|