久久国产亚洲日韩一本,欧美日韩专区国产精品,久久精品成人欧美大片,久久久久久久岛国免费AV,亚洲欧洲精品一区二区

新聞建站cms系統、政府cms系統定制開發

廣州網站建設公司-閱速公司

asp.net新聞發布系統、報紙數字報系統方案
/
http://www.ainiby.com/
廣州網站建設公司
您當前位置:首頁>sqlserver數據庫

sqlserver數據庫

批量刪除表,sql server循環查詢表數據(循環數據庫中的表記錄游標循環刪除動態表)

發布時間:2024/8/3 8:51:52  作者:Admin  閱讀:21  

廣告:

DECLARE @tableName NVARCHAR(255)
DECLARE tableCursor CURSOR FOR
select name from sysobjects where name like 'TMP%'
OPEN tableCursor
FETCH NEXT FROM tableCursor INTO @tableName

WHILE @@FETCH_STATUS = 0
BEGIN 
 --PRINT @tableName
 exec('drop table '+ @TableName)
 FETCH NEXT FROM tableCursor INTO @tableName
END

CLOSE tableCursor
DEALLOCATE tableCursor 
DECLARE @tableName NVARCHAR(255)
DECLARE tableCursor CURSOR FOR
select name from sysobjects where name like 'TMP%' and and OBJECTPROPERTY(id, N'IsUserTable') = 1
OPEN tableCursor
FETCH NEXT FROM tableCursor INTO @tableName

WHILE @@FETCH_STATUS = 0
BEGIN 
 --PRINT @tableName
 exec('dbcc checktable('+@TableName+',repair_allow_data_loss)')
 FETCH NEXT FROM tableCursor INTO @tableName
END

CLOSE tableCursor
DEALLOCATE tableCursor 
DECLARE @tableName NVARCHAR(255)
DECLARE tableCursor CURSOR FOR
select name from sysobjects where name like 'TMP%' and xtype='U'
OPEN tableCursor
FETCH NEXT FROM tableCursor INTO @tableName

WHILE @@FETCH_STATUS = 0
BEGIN 
 --PRINT @tableName
 exec('dbcc checktable('+@TableName+',repair_allow_data_loss)')
 FETCH NEXT FROM tableCursor INTO @tableName
END

CLOSE tableCursor
DEALLOCATE tableCursor 

廣告:

相關文章
批量刪除表
cms新聞系統購買咨詢
掃描關注 廣州閱速軟件科技有限公司
掃描關注 廣州閱速科技
主站蜘蛛池模板: 德格县| 交城县| 巴马| 德化县| 黄陵县| 东平县| 江安县| 洪江市| 荔浦县| 灵丘县| 池州市| 镇康县| 上犹县| 迭部县| 博客| 杭州市| 叙永县| 军事| 宁城县| 云安县| 吐鲁番市| 盐山县| 莲花县| 长垣县| 贵定县| 洞头县| 莱州市| 宁晋县| 两当县| 崇礼县| 荣昌县| 从江县| 石嘴山市| 水富县| 临海市| 大兴区| 扶沟县| 雷波县| 沂南县| 通许县| 镇雄县|