Since operational wise or user experience wise, truncate is equal to DELETE entire table and DELETE is a DML statement, most people think that Truncate is DML statement.
So let us verify this.
Let us create a table to play around.
Let me create user with DML permissions.
Now using this user let us truncate the employee table.
You will end up with an error as shown below.
Msg 1088, Level 16, State 7, Line 2
Cannot find the object "Employee" because it does not exist or you do not have permissions.
You will end up with an error as shown below.
Now let us create a user with DDL permission.
Let us truncate the table using this user.
since this is a success Truncate is a DDL statement.
Nice.
ReplyDelete