今天又学到一招,可以快速删除数据库中所有的用户表中的数据。我是个菜鸟,望各位大神多多指教 select 'truncate table ' + Name + ';' from sysobjects where xtype='U' order by name asc; 该条语句执行之后会将数据库 ...
select truncate table Name from sysobjects where xtype U order by name asc 该条语句执行之后会将数据库中所有的表都查询出来,复制出来之后执行truncate语句即可 sysobjects 在数据库内创建的每个对象 约束 默认值 日志 规则 存储过程等 在表中占一行。只有在tempdb内,每个临时对象才在该表中占一行。 列名 ...
2016-11-18 12:38 0 16662 推荐指数:
今天又学到一招,可以快速删除数据库中所有的用户表中的数据。我是个菜鸟,望各位大神多多指教 select 'truncate table ' + Name + ';' from sysobjects where xtype='U' order by name asc; 该条语句执行之后会将数据库 ...
select 'truncate table ' + Name + ';' from sysobjects where xtype='U' order by name asc; 该条语句执行之后会将数据库中所有的表都查询出来,复制出来之后执行truncate语句即可 sysobjects ...
...
,你需要再运行一次这个结果集就可以删除所有的表而不删除数据库了 例如: ①新建查询: ...
(@sql) 如果要删除所有用户表中的内容,可以执行以下语句: declare @sql varchar( ...
select concat('drop table ',table_name,';') from TABLES where table_schema='数据库名称'; select concat('truncate ',table_name,';') from TABLES where ...
删除数据表所有数据:truncate table TAB_User ...
1、先禁用数据库中所有的约束 select 'alter table ' || table_name || ' disable constraint ' ||constraint_name || ';'from user_constraintswhere constraint_type = 'R ...