Showing posts with label proc. Show all posts
Showing posts with label proc. Show all posts

Sunday, March 11, 2012

Controlling create & drop proc, view privilege

Hi,
Is there a way to allow a user, who has access to a db say "DevDB" as
db_datareader, to only create & drop stored procs and views in DevDB. What
extra permissions does the user need ?
I tried playing with the "grant create proc to user" command. But it lets
the user create procs with him as owner. In the current case, the applicatio
n
needs all objects to be owned by dbo, so the user needs to be able to run
"create proc dbo.tempProc as ..."
In case there is a solution to the above, we might fall into the next trap.
since the user can create procedures with dbo as the owner, if the SP has a
drop table command, that would execute in the owners context and hence would
drop the table. Is that right ? I guess the question is when an SP is
executed does it use the permissions of the owner of the SP or the user
executing the SP
ManiMani
You can EXECUTION permission on the stored procedure for the user
Also ,you can remove him/her from sysadmin fixed server role but he/she
should be member db_owner fixed database and must qualified User.sp
"Mani" <Mani@.discussions.microsoft.com> wrote in message
news:0C3FBF63-843E-465E-98C0-4BE9152BF08F@.microsoft.com...
> Hi,
> Is there a way to allow a user, who has access to a db say "DevDB" as
> db_datareader, to only create & drop stored procs and views in DevDB. What
> extra permissions does the user need ?
> I tried playing with the "grant create proc to user" command. But it lets
> the user create procs with him as owner. In the current case, the
application
> needs all objects to be owned by dbo, so the user needs to be able to run
> "create proc dbo.tempProc as ..."
> In case there is a solution to the above, we might fall into the next
trap.
> since the user can create procedures with dbo as the owner, if the SP has
a
> drop table command, that would execute in the owners context and hence
would
> drop the table. Is that right ? I guess the question is when an SP is
> executed does it use the permissions of the owner of the SP or the user
> executing the SP
> --
> Mani|||1. A user needs to be a member of db_owner or db_ddladmin
roles (or sysadmin) to create a objects owned by dbo.
Members of db_owner and db_ddladmin need to qualify the
owner as dbo.object when they create the objects to be owned
by dbo.
2. It depends first on ownership the ownership chain. If the
ownership chains are intact, the secuirty is checked for
permissions to execute the stored procedure only. If the
ownership chain is broken, permissions are checked on each
branch where the owner of the object is different. You can
find more information in books online under ownership chains
-Sue
On Wed, 27 Oct 2004 14:33:04 -0700, "Mani"
<Mani@.discussions.microsoft.com> wrote:

>Hi,
> Is there a way to allow a user, who has access to a db say "DevDB" as
>db_datareader, to only create & drop stored procs and views in DevDB. What
>extra permissions does the user need ?
>I tried playing with the "grant create proc to user" command. But it lets
>the user create procs with him as owner. In the current case, the applicati
on
>needs all objects to be owned by dbo, so the user needs to be able to run
>"create proc dbo.tempProc as ..."
>In case there is a solution to the above, we might fall into the next trap.
>since the user can create procedures with dbo as the owner, if the SP has a
>drop table command, that would execute in the owners context and hence woul
d
>drop the table. Is that right ? I guess the question is when an SP is
>executed does it use the permissions of the owner of the SP or the user
>executing the SP|||Thanks Uri and Sue for your responses.
"Sue Hoegemeier" wrote:

> 1. A user needs to be a member of db_owner or db_ddladmin
> roles (or sysadmin) to create a objects owned by dbo.
> Members of db_owner and db_ddladmin need to qualify the
> owner as dbo.object when they create the objects to be owned
> by dbo.
> 2. It depends first on ownership the ownership chain. If the
> ownership chains are intact, the secuirty is checked for
> permissions to execute the stored procedure only. If the
> ownership chain is broken, permissions are checked on each
> branch where the owner of the object is different. You can
> find more information in books online under ownership chains
> -Sue
>
> On Wed, 27 Oct 2004 14:33:04 -0700, "Mani"
> <Mani@.discussions.microsoft.com> wrote:
>
>

Control Source field as value list

Hi!
I have a strored proc which adds up fields separated by semicolon into a new one and I'd like to use it as a combo box's control source field as a Value list. But it's just insert the whole field into one line like value1;value2;value3 .
Is there any way to get these values selectable in the combo box?

Thanks in advance for any help.

VillWhat interface are you using. Access? You should post this in the appropriate forum, as it is not a SQL Server issue.

Thursday, March 8, 2012

Control jobs using SQL code?

Is there a way (system stored proc) to schedule/reschedule jobs through
SQL code (stored procedure) instead of GUI? We have a job set up on SQL
server and we are trying to control scheduling piece of it through
stored proc. Any help would be appreciated. Thanx!
*** Sent via Developersdex http://www.examnotes.net ***Have a look at sp_update_jobschedule in Books Online. This procedure is in t
he
msdb database, so it is used like
EXEC msdb.dbo.sp_update_jobschedule
"Test Test" wrote:

> Is there a way (system stored proc) to schedule/reschedule jobs through
> SQL code (stored procedure) instead of GUI? We have a job set up on SQL
> server and we are trying to control scheduling piece of it through
> stored proc. Any help would be appreciated. Thanx!
>
> *** Sent via Developersdex http://www.examnotes.net ***
>|||have a look at following system stored procedures in BOL, there are few more
as well which are related to scheduling the job, you can have a look at them
in BOL.
sp_add_job
sp_add_jobstep
sp_add_jobschedule
sp_delete_job
sp_help_job
sp_help_jobstep
sp_update_job
"Test Test" wrote:

> Is there a way (system stored proc) to schedule/reschedule jobs through
> SQL code (stored procedure) instead of GUI? We have a job set up on SQL
> server and we are trying to control scheduling piece of it through
> stored proc. Any help would be appreciated. Thanx!
>
> *** Sent via Developersdex http://www.examnotes.net ***
>|||Thanks, Mark. It really helps!
*** Sent via Developersdex http://www.examnotes.net ***

Saturday, February 25, 2012

Contains with Var & WildCard

Inside of a stored proc, how would I issue a Contains using a variable and a
wild card, this dosent work
declare @.myvar varchar(50) -- this would be an imput param
set @.myvar = 'hello' -- this would be an imput param
select whatever
from CONTAINS(fieldname, ' " ' + @.myvar + ' *" ')
thanks!Try putting it seperately:
set @.myvar = '"' + @.myvar + '*" '
CONTAINS(fieldname, @.myvar )
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Don Schilling" <fake@.fake.com> schrieb im Newsbeitrag
news:OFlSiDQTFHA.548@.tk2msftngp13.phx.gbl...
> Inside of a stored proc, how would I issue a Contains using a variable and
> a
> wild card, this dosent work
> declare @.myvar varchar(50) -- this would be an imput param
> set @.myvar = 'hello' -- this would be an imput param
> select whatever
> from CONTAINS(fieldname, ' " ' + @.myvar + ' *" ')
> thanks!
>|||constains() only allows literals. so, you want to do the concatenation
outside of the function.
e.g.
@.newvar = quotename(@.myvar+'*','"')
...contains(col,@.newvar)
-oj
"Don Schilling" <fake@.fake.com> wrote in message
news:OFlSiDQTFHA.548@.tk2msftngp13.phx.gbl...
> Inside of a stored proc, how would I issue a Contains using a variable and
> a
> wild card, this dosent work
> declare @.myvar varchar(50) -- this would be an imput param
> set @.myvar = 'hello' -- this would be an imput param
> select whatever
> from CONTAINS(fieldname, ' " ' + @.myvar + ' *" ')
> thanks!
>|||Tried, no luck.
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:evruUQQTFHA.3012@.TK2MSFTNGP14.phx.gbl...
> Try putting it seperately:
> set @.myvar = '"' + @.myvar + '*" '
> CONTAINS(fieldname, @.myvar )
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
>
> "Don Schilling" <fake@.fake.com> schrieb im Newsbeitrag
> news:OFlSiDQTFHA.548@.tk2msftngp13.phx.gbl...
and
>|||Tried, dosent work.
"oj" <nospam_ojngo@.home.com> wrote in message
news:O6nKCXQTFHA.1896@.TK2MSFTNGP14.phx.gbl...
> constains() only allows literals. so, you want to do the concatenation
> outside of the function.
> e.g.
> @.newvar = quotename(@.myvar+'*','"')
> ...contains(col,@.newvar)
> --
> -oj
>
> "Don Schilling" <fake@.fake.com> wrote in message
> news:OFlSiDQTFHA.548@.tk2msftngp13.phx.gbl...
and
>