AccessBlog.net

News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Alex
Name:Alex Dybenko

Location:Moscow, Russia

Tuesday, November 15, 2005

How to clear SQL Server database

Database Journal just published a very useful script to Truncate Database by Shane Lively. What I found also interesting there – that you can disable constraints/triggers for certain table using ALTER TABLE MyTable NOCHECK CONSTRAINT ALL and ALTER TABLE MyTable DISABLE TRIGGER ALL, and reset identity seed using DBCC CHECKIDENT ("MyTable", RESEED, 0). But what I don’t understand – why author uses Delete instead of Truncate, which is faster and more efficient?

2 Comments:

Blogger Crispin said...

Why delete instead of truncate? Perhaps because truncate requires greater permissions than delete. "The minimum permission required is ALTER on table_name. TRUNCATE TABLE permissions default to the table owner, members of the sysadmin fixed server role, and the db_owner and db_ddladmin fixed database roles, and are not transferable."

11:06 PM  
Blogger Alex Dybenko said...

Yes, agree

9:37 AM  

Post a Comment

<< Home