国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > SQL Server > 正文

MSSQL 刪除數據庫里某個用戶所有表里的數據

2024-08-31 00:59:09
字體:
來源:轉載
供稿:網友
-->Title:刪除數據庫里某個用戶所有表里的數據
-->Author:wufeng4552
-->Date :2009-09-21 15:08:41
--方法1

復制代碼 代碼如下:


declare @uname varchar(20)
declare cuser cursor for
select so.name
from sysobjects so,sysusers su where so.uid=su.uid and su.name='Stone'
and so.xtype='U'
open cuser
fetch next from cuser into @uname
while(@@fetch_status=0)
begin
exec('truncate table [Stone].['+@uname+']')
fetch next from cuser
end
close cuser
deallocate cuser


--方法2

復制代碼 代碼如下:


exec sp_msforeachtable @command1="truncate table ? ;",@whereand='and schema_id = (select schema_id from sys.schemas where [name] =''Stone'')'

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 中江县| 盐城市| 石棉县| 内乡县| 茂名市| 湛江市| 铁岭市| 蓬安县| 三穗县| 钟山县| 大方县| 双江| 潼南县| 威信县| 理塘县| 苍溪县| 青冈县| 望奎县| 瓦房店市| 盘锦市| 加查县| 宜春市| 大邑县| 革吉县| 全南县| 冕宁县| 焉耆| 云龙县| 三都| 枞阳县| 信阳市| 方正县| 巨野县| 崇阳县| 恩平市| 乐至县| 大荔县| 西和县| 盘锦市| 调兵山市| 荃湾区|