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
 General SQL Server Forums
 New to SQL Server Programming
 select statement in execute

Author  Topic 

rnbguy
Constraint Violating Yak Guru

293 Posts

Posted - 2006-12-04 : 00:45:53
I would like to put a select statement inside this execute statement

use [AnalysisReport]
GO
GRANT EXECUTE ON (select statement) TO [test]
GO


anyone?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-12-04 : 00:50:52
You can grant permissions on database objects, not on the statements.

Alternatively, you can use:

GRANT SELECT ON <table-name> TO [TEST]
GO


Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

rnbguy
Constraint Violating Yak Guru

293 Posts

Posted - 2006-12-04 : 00:58:23
but i want to grant on several stored procedures not just one... or in ur example several tables
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-12-04 : 01:40:37
then..
grant execute on sp1 to test
grant execute on sp2 to test
.
.
.

--------------------
keeping it simple...
Go to Top of Page

rnbguy
Constraint Violating Yak Guru

293 Posts

Posted - 2006-12-04 : 01:48:17
wow theres thousands of them its okay im going to use sql server 2005 interface to do it
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-12-04 : 03:17:36
yep, if you have schema defined then it'll be a breeze for you...
or you can generate the tsql statements...

select 'grant execute on ' + specific_name + ' to user1' from information_schema.routines
where routine_type='procedure'

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -