Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Permission to Create Table inside Stored Procedure

Author  Topic 

denis_the_thief
Aged Yak Warrior

596 Posts

Posted - 2010-06-28 : 11:23:15
I'm stuck on the problem that inside a Stored Procedure, a user needs to create a table under dbo but gets a permission error (Create table permission denied). Any ideas how I can solve this?

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-06-28 : 11:39:17
You need to have "Create table" permission in the database.
Check with the database administrator to get the permission.


Have a look at the following link for info on various permissin:

http://technet.microsoft.com/en-us/library/ms178569.aspx
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-06-28 : 11:41:24
why would you want to do this? -- let a user create a new base table?



Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

denis_the_thief
Aged Yak Warrior

596 Posts

Posted - 2010-06-28 : 12:02:17
quote:
Originally posted by Transact Charlie

why would you want to do this? -- let a user create a new base table?



Not saying it is ideal, but... A User needs to run a Stored Procedure to create a Table, which is sort of a Temp Table. This table only exists for Reporting off it and it gets refreshed everyday. One of those tables you are not sure you are going to need for long, then 2 years later, it's still there. The Stored Procedure says to create the table it if it does not exist. I suppose if we ensure it exists in the first place (ie. not by Stored Procedure means), we won't have this problem.
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-06-29 : 04:57:34
IF the table has a fixed ddl then it would probably be better to make it permanently. IF you needed it to be used by multiple users then you could add a proccessKey column / user column.

I could see the situation with your current setup where one user deletes what another needs.


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -