December 4, 2009 at 12:24 pm
That looks interesting
I guess you need a Job to look for the messages to start the other Jobs?
Something like:
RECEIVE TOP (1) * FROM MyReceivingQueue
I have go out now ... but looks useful
🙂
C# Gnu
____________________________________________________
December 4, 2009 at 12:39 pm
It is a bit more than that but that is the basis. I use "internal activation" so that I don't have to schedule another process it just pops into being and services the queue and then pops out..
CEWII
December 4, 2009 at 12:51 pm
Ah I see
http://articles.techrepublic.com.com/5100-10878_11-6156264.html
ALTER QUEUE [SalesQueue] WITH ACTIVATION
( STATUS = ON,
MAX_QUEUE_READERS = 1,
PROCEDURE_NAME = usp_RecordSaleMessage,
EXECUTE AS OWNER
);
Rather like a trigger - but as you say with any rights you like..
Now I am going out!
Thanks
C# Gnu
____________________________________________________
December 4, 2009 at 12:57 pm
Kind of like an asynchronous trigger, that can run in any security context you want..
CEWII
December 4, 2009 at 1:08 pm
pawan_kirtikar (12/4/2009)
Hi,Due to security reasons we cannot use the xp_cmdshell command to execute the system level calls through the stored procedures. We want to execute batch files at a specified time using the SQL Server 2005 stored procedures.
As much as I am a fan of Service Broker (Queues, RECEIVE, etc...), I don't think that it should be necessary here. Given the OP's requirements ("at a specified time"), the SQL Agent should be able to handle it all by itself without anything else, including the system stored procedures. Just schedule it to run at the required time. Done.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
December 4, 2009 at 1:14 pm
Yes I thought that, but does
at a specified time
mean at regular intervals or does it mean at the time the Application wants to call it?
{edit - the mention of stored procedures in post makes one think OP has reason for not using SQL Agent - but we will have to see}
Maybe OP could clarify ....
Waiting 4 taxi..
C# Gnu
____________________________________________________
December 4, 2009 at 1:20 pm
C# Screw (12/4/2009)
Yes I thought that, but doesat a specified time
mean at regular intervals or does it mean at the time the Application wants to call it?
Maybe OP could clarify ....
Waiting 4 taxi..
The later would be "at the requested time", and not the "specified" time. Specifications happen before the application, not during it.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
December 4, 2009 at 1:23 pm
The later would be
do you mean latter rather than later!
Easy to have wrong meaning in posts 😀
c#
C# Gnu
____________________________________________________
December 4, 2009 at 1:46 pm
Yes, the latter.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
December 5, 2009 at 10:36 am
Heh... wait just a minute, now. Let's ask the question... specifically, WHAT do those batch files do? You may not need to use anything in those batch files.
Also, what's wrong with setting up the proxy for xp_cmdshell for those jobs?
--Jeff Moden
Change is inevitable... Change for the better is not.
December 5, 2009 at 8:59 pm
Jeff Moden (12/5/2009)
Heh... wait just a minute, now. Let's ask the question... specifically, WHAT do those batch files do? You may not need to use anything in those batch files.Also, what's wrong with setting up the proxy for xp_cmdshell for those jobs?
Actually, the question isn't whether they need a batch file, it's whether or not they actually need to involve SQL Server in this at all.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
December 5, 2009 at 9:11 pm
Heh... and I was thinking the other way around. Depending on what those batch files do, you may not have to use anything BUT SQL Server. 😛
--Jeff Moden
Change is inevitable... Change for the better is not.
December 9, 2009 at 6:59 am
I'd personally go the route that Elliot first proposed and use SQL Agent with CmdExec tasks and then use sp_start_job in a certificate signed wrapper stored procedure. Using the same certificate a server level login can be created that no one else can use, and can be granted the rights necessary to call into sp_start_job for any job on the server. The application users only need EXECUTE rights to this wrapper stored procedure and nothing else. The certificate takes care of the rest of the permissions issues. Its not that tough to do. If you'd like to see the code to make it happen I'd be happy to stub out an example and post it here.
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
December 9, 2009 at 7:10 am
certificate signed wrapper stored procedure
sounds like an excellent solution for elevated sp permissions.
(not that we are sure of the problem, maybe OP is on holiday)
C# Gnu
____________________________________________________
December 10, 2009 at 1:50 am
And here is link to one of Jonathan's articles, of relevance :
Trading in xp_cmdshell for SQLCLR
http://www.sqlservercentral.com/articles/SQLCLR/65656/
Although Jonathan's elevated stored proc with certificate sounds most useful.
C# Gnu
____________________________________________________
Viewing 15 posts - 16 through 30 (of 32 total)
You must be logged in to reply to this topic. Login to reply