2012年3月20日星期二

Any way to make a stored procedure process asynchronously?

I'd like to know if there is any way to get a stored procedure to process
asynchronously. Ideally, I would kick off the procedure from within a
trigger. I would not need any return values or need to worry about
transactions.We do it by creating one-time jobs in our system. a bit cumbersome but
works.
Peter
"Random" <cipherlad@.hotmail.com> wrote in message
news:O4nvQqgQGHA.516@.TK2MSFTNGP15.phx.gbl...
> I'd like to know if there is any way to get a stored procedure to process
> asynchronously. Ideally, I would kick off the procedure from within a
> trigger. I would not need any return values or need to worry about
> transactions.
>|||Consider using Service Broker for this (assuming you are on 2005, no version
mentioned in the
OP...).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Random" <cipherlad@.hotmail.com> wrote in message news:O4nvQqgQGHA.516@.TK2MSFTNGP15.phx.gbl
..
> I'd like to know if there is any way to get a stored procedure to process
asynchronously.
> Ideally, I would kick off the procedure from within a trigger. I would no
t need any return values
> or need to worry about transactions.
>|||Service Broker would be IDEAL if we were on version 2005. Unfortunately, we
cannot mandate at this time that all our clients move to 2005, so we are on
2000 for this.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:%23DlND0gQGHA.5808@.TK2MSFTNGP12.phx.gbl...
> Consider using Service Broker for this (assuming you are on 2005, no
> version mentioned in the OP...).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Random" <cipherlad@.hotmail.com> wrote in message
> news:O4nvQqgQGHA.516@.TK2MSFTNGP15.phx.gbl...
>|||SQL Server is a database management system, it will typically process things
in sequential order and not asynchronously.
ADO supports the execution stored procedures, SQL, etc. asynchronously, so
perhaps the sequence of events would best be called from the application
side.
http://support.microsoft.com/defaul...kb;en-us;194960
http://msdn.microsoft.com/library/d...nc
2.asp
http://msdn2.microsoft.com/en-us/library/zw97wx20.aspx
Here is an article describing various methods of calling a DTS package from
T-SQL, including the option of calling (starting) a job asynchronously from
a trigger.
http://www.sqldts.com/default.aspx?219
I don't know what the cirsumstances or exact requirements are, but if it is
not important that the stored procedure complete within a specific time
window or within a transaction, then I have in the past implemented a table
that schedules tasks through the insertion of rows. A job can then be
scheduled to poll the table at intervals and execute the procedure calls as
needed. An added benefit is that the table itself is sort of a meta data
history of when the task has been performed.
"Random" <cipherlad@.hotmail.com> wrote in message
news:O4nvQqgQGHA.516@.TK2MSFTNGP15.phx.gbl...
> I'd like to know if there is any way to get a stored procedure to process
> asynchronously. Ideally, I would kick off the procedure from within a
> trigger. I would not need any return values or need to worry about
> transactions.
>|||I haven't ever tried this myself but I've heard of people using jobs to do
this and have the first stored proc manually start a job which kicks off the
second SP. This is obviously a lot less efficient than Service Broker but
it should work.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Random" <cipherlad@.hotmail.com> wrote in message
news:eR33oUhQGHA.4344@.TK2MSFTNGP12.phx.gbl...
> Service Broker would be IDEAL if we were on version 2005. Unfortunately,
> we cannot mandate at this time that all our clients move to 2005, so we
> are on 2000 for this.
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
> in message news:%23DlND0gQGHA.5808@.TK2MSFTNGP12.phx.gbl...
>

没有评论:

发表评论