Cannot find the object because it does not exist or you do not have permissions. Error in SQL Server

前端 未结 14 2078
面向向阳花
面向向阳花 2020-12-05 12:35

I have a database and have a Sql script to add some fields to a table called \"Products\" in the database.

But when i am executing this script, I am getting the foll

14条回答
  •  离开以前
    2020-12-05 13:09

    This could a permission issue. The user needs at least ALTER permission to truncate a table. Another option is to call DELETE FROM instead of TRUNCATE TABLE, but this operation is slower because it writes to the Log file, whereas TRUNCATE does not write to the log file.

    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. However, you can incorporate the TRUNCATE TABLE statement within a module, such as a stored procedure, and grant appropriate permissions to the module using the EXECUTE AS clause.

提交回复
热议问题