Re: With in a SP Truncate dbo.table table-name permissions..

From: Andrew J. Kelly (akelly@targitinteractive.com)
Date: 07/18/02


From: "Andrew J. Kelly" <akelly@targitinteractive.com>
Date: Thu, 18 Jul 2002 09:45:22 -0400


Directly from BooksOnLine:

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.

--
Andrew J. Kelly   SQL MVP
Targitinteractive, Inc.
"venkat" <vgaddam@us.imshealth.com> wrote in message
news:17a1501c22e60$553526c0$2ae2c90a@hosting.microsoft.com...
> Hi,
>
> I have procedure with in the procedure I  there is a
> Truncate dbo.table table-name. According to sql server
> books on line. If i give execute permission to this
> procedure to a user that user should be able to execute
> this procedure with out any other permissions on the
> table. But that&#8217;s not true, it gives error does not have a
> truncate table permissions on the table. I know it works
> fine if I give "db_ddladmin" permissions on that user.
>
> But I cannot give this permission on the production
> database to a normal user.
>
> If anybody has the solution please let me know.
>
> SQL Server Books on line:
> Qualifying Names Inside Stored Procedures
> Inside a stored procedure, object names used with
> statements (for example, SELECT or INSERT) that are not
> user-qualified default to the owner of the stored
> procedure. If a user who creates a stored procedure does
> not qualify the name of the tables referenced in SELECT,
> INSERT, UPDATE, or DELETE statements within the stored
> procedure, access to those tables through the stored
> procedure is restricted by default to the creator of the
> procedure.
>
> Object names used with the statements ALTER TABLE, CREATE
> TABLE, DROP TABLE, TRUNCATE TABLE, CREATE INDEX, DROP
> INDEX, UPDATE STATISTICS, and DBCC must be qualified with
> the name of the object owner if other users are to use of
> the stored procedure. For example, Mary, who owns table
> marytab, must qualify the name of her table when it is
> used with one of these statements if she wants other users
> to be able to execute the stored procedure in which the
> table is used.
>
> This rule is necessary because object names are resolved
> when the stored procedure is run. If marytab is not
> qualified and John tries to execute the procedure, SQL
> Server looks for a table called marytab owned by John.
>
>
> Thanks a millions
> Venkat
> gaddamv@hotmail.com
> 610 834 5241
>


Relevant Pages

  • Permissions for executing a stored procedure
    ... Truncate table permissions only default to table owner, ... So, eventhough, you have granted execute permissions to ... Instead using TRUNCATE TABLE, you could use DELETE FROM, ... >We have a stored procedure that has code in it to ...
    (microsoft.public.sqlserver.security)
  • Re: Cant create/edit stored procs in VS.Net
    ... You're probably right about the permissions... ... dbo in the database you want to create procs from VS.Net in... ... connection in server explorer.. ... > to create datatable or stored procedure does appear in the popup menu. ...
    (microsoft.public.sqlserver.programming)
  • Re: Cant create/edit stored procs in VS.Net
    ... You're probably right about the permissions... ... dbo in the database you want to create procs from VS.Net in... ... connection in server explorer.. ... > to create datatable or stored procedure does appear in the popup menu. ...
    (microsoft.public.sqlserver.setup)
  • Re: Cant create/edit stored procs in VS.Net
    ... You're probably right about the permissions... ... dbo in the database you want to create procs from VS.Net in... ... connection in server explorer.. ... > to create datatable or stored procedure does appear in the popup menu. ...
    (microsoft.public.vsnet.setup)
  • Re: Cant create/edit stored procs in VS.Net
    ... You're probably right about the permissions... ... dbo in the database you want to create procs from VS.Net in... ... connection in server explorer.. ... > to create datatable or stored procedure does appear in the popup menu. ...
    (microsoft.public.sqlserver.security)