Grant permission to create table in SP

  • Hi everyone,

    There is one user who has permission to execute one SP.

    In that SP, one table is created in database and finally it is dropped at the end of the SP.

    When this user is trying to run this SP he is getting following error.

    "CREATE TABLE permission denied in database".

    Please help me wth this.

  • Is he member of the dbcreator server role?

    updated 2/25/2011

    damn, for some reason I read CREATE DATABASE 😉

    __________________________
    Allzu viel ist ungesund...

  • atikdesai (2/23/2011)


    Hi everyone,

    There is one user who has permission to execute one SP.

    In that SP, one table is created in database and finally it is dropped at the end of the SP.

    When this user is trying to run this SP he is getting following error.

    "CREATE TABLE permission denied in database".

    Please help me wth this.

    You can sign the procedure with a certificate or key to grant CREATE TABLE within the procedure only, but why are you creating and dropping a 'real' table inside a procedure?

  • SQLkiwi (2/24/2011)


    atikdesai (2/23/2011)


    Hi everyone,

    There is one user who has permission to execute one SP.

    In that SP, one table is created in database and finally it is dropped at the end of the SP.

    When this user is trying to run this SP he is getting following error.

    "CREATE TABLE permission denied in database".

    Please help me wth this.

    You can sign the procedure with a certificate or key to grant CREATE TABLE within the procedure only, but why are you creating and dropping a 'real' table inside a procedure?

    Thanks for replying... Actually this SP has been developed by some other person and he left.

    Please tell me how I can sign the procedure with a certificate or key to grant CREATE TABLE within the procedure only.

  • atikdesai (2/24/2011)


    Actually this SP has been developed by some other person and he left.

    Well that sort of thing happens from time to time 😉

    You should still be able to understand what it is doing, and why it needs to create a real table. It seems unwise to modify something you don't understand yet.

    Please tell me how I can sign the procedure with a certificate or key to grant CREATE TABLE within the procedure only.

    There is a Microsoft tutorial here:

    http://msdn.microsoft.com/en-us/library/bb283630.aspx

    Paul

  • I would suggest that you create a temp table (in tempdb) for this as workaround.

    You will still have the create table permission issue in tempdb but what have done is maintain an empty 'template' table in the current database, then create the temp table in tempdb via select into.

    If you tempdb is tuned for good performance you usually be better off with your temp tables in there Vs in the current database.

    The probability of survival is inversely proportional to the angle of arrival.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply