Showing posts with label exec. Show all posts
Showing posts with label exec. Show all posts

Friday, March 23, 2012

How to allow use to exec xp_sendmail

I have a stored proc that assigns a value to a field based on user input from an Access front end.

The last part of the stored proc sends an email if certain conditions are met.

It appears that users do not have permission to execute xp_sendmail. I guess this is because it is executed on the master database. Is there a way I can give them permission to this stored proc?

The users are getting this message:

EXECUTE permission denied on bject 'xp_sendmail', 'database master', owner 'dbo'.(#229)You can grant a user to execute xp_sendmail by going to properties of xp_sendmail in master database and grant the user permission to execute.

Monday, March 19, 2012

how to add table and all its index for replication

If you're talking about code as in stored procedure
calls, the stored procedures you need are:
exec sp_addarticle
exec sp_addsubscription or exec sp_refreshsubscriptions
I can script mine out for you and post them up, but it
would be more useful for you to create a dummy
publication and add the new articles using enterprise
manager. After they're created, right click the
publication and get EM to script out the publications.
Selecting the relevant sp_addarticle sp_and
addsubscription bits will give you what you need.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
I guess i can try it out.. Are indexes added thru sp_addarticle ? or is
there a parameter in there that states to includes indexes,
constraints,etc..?
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:0faf01c4f6f9$292fbae0$a501280a@.phx.gbl...
> If you're talking about code as in stored procedure
> calls, the stored procedures you need are:
> exec sp_addarticle
> exec sp_addsubscription or exec sp_refreshsubscriptions
> I can script mine out for you and post them up, but it
> would be more useful for you to create a dummy
> publication and add the new articles using enterprise
> manager. After they're created, right click the
> publication and get EM to script out the publications.
> Selecting the relevant sp_addarticle sp_and
> addsubscription bits will give you what you need.
> Rgds,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
|||Have a look at @.schema_option in sp_addarticle. If you
select teh elipsis button in EM and on the article
properties, snapshot tab, you'll see the corresponding
checkboxes. The easiest thing to do is to select what you
want graphically, and then have EM do the bitmask logic
to generate the correct parameter value.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

How to add same user to diff DBs on diff Servers?

Does anybody know,
how to add same user to diff DBs on diff Servers?
something like this,
EXEC sp_adduser 'xxxxx'--add user to server1.DB1
EXEC server2.master.dbo. sp_adduser 'xxxxx'--add user to server2.DB2
or other ways?
Thanks.Since SQL Server uses logins at the server level and users at the database
level probably you would need to add the logins first. You can use the
Transfer Logins DTS Task or simply use Enterprise Manager/Management Studio.
This would add the login at the server level.
To add the user, just select the login name on 'Security, Logins',
right-click and select Properties. On the Database Access tab, select the
database and database roles.
Giving exactly the right permissions as the original database would require
scripting the original database.
Hope this helps,
Ben Nevarez, MCDBA, OCP
Database Administrator
"hh" wrote:

> Does anybody know,
> how to add same user to diff DBs on diff Servers?
> something like this,
> EXEC sp_adduser 'xxxxx'--add user to server1.DB1
> EXEC server2.master.dbo. sp_adduser 'xxxxx'--add user to server2.DB2
> or other ways?
> Thanks.|||Thanks Ben.
"Ben Nevarez" wrote:
> Since SQL Server uses logins at the server level and users at the database
> level probably you would need to add the logins first. You can use the
> Transfer Logins DTS Task or simply use Enterprise Manager/Management Studi
o.
> This would add the login at the server level.
> To add the user, just select the login name on 'Security, Logins',
> right-click and select Properties. On the Database Access tab, select the
> database and database roles.
> Giving exactly the right permissions as the original database would requir
e
> scripting the original database.
> Hope this helps,
> Ben Nevarez, MCDBA, OCP
> Database Administrator
>
> "hh" wrote:
>