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 2000 Forums
 Transact-SQL (2000)
 Truncate options

Author  Topic 

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2007-03-12 : 22:34:41
How can I give the access to a user "emp_load_app" to truncate and insert data only to tbl_emp table of emp_load database.This user should not have any other access.Is it possible.

Kristen
Test

22859 Posts

Posted - 2007-03-12 : 22:38:36
To TRUNCATE a table your user needs to be sysadmin, db_owner or db_ddladmin - so that's going to be tricky!

If DELETE would be enough then you can do:

GRANT INSERT, DELETE on [tbl_emp] TO MyUser

and avoid granting any permissions on the other tables.

Kristen
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2007-03-12 : 22:42:23
No it should be truncate only ,Can we create some role and use it or can we create job and this job should be called by that user.
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2007-03-12 : 23:02:54
I tried assigning the user to the role and created a stored procedure which will truncate the table.The role will have permission to execute the Stored procedure.But its still giving me error :

Server: Msg 3704, Level 16, State 1, Procedure usp_test, Line 4
User does not have permission to perform this operation on table tbl_emp
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2007-03-13 : 15:13:57
Have any one did this before :

Basically a user should be able to select/insert/Truncate and no other option like changing the schema or accessing any other tables.

Please let me know
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-03-13 : 15:32:32
Don't you trust Kristen?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2007-03-13 : 16:07:07
Since you posted in the forum, I assume you aren't able to use 2005. If that is the case, Kristen is correct and you are going to have make a choice.

However, if you do have access to 2005, check out this article:
[url]http://builder.com.com/5100-6388_14-6158511.html[/url]

-Ryan
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-03-14 : 05:08:58
That looks handy

I wonder if I can use that to stamp out the last few vestiges of SELECT permissions on tables - because of dynamic SQL calls [from a User Defined SProc] to sp_ExecuteSQL ?

Kristen
Go to Top of Page
   

- Advertisement -