Monday, March 26, 2012
Retriveing the process ID for a SQL Server Agent job being run
which is run Asynchronously on a set of databases each containing a
batch.
What I would like to do is to retrieve the Process ID of a particular
instance of this agent when its being called and write that to a table
with the ID for the individual database.
Im having little luck at finding this information. I look at sp_who2
and sysprocesses...but get a link to the job.
Thanks for your help on this
ChrisHi Chris,
Try @.@.spid, db_id() and db_name().
Hope this helps,
Ben Nevarez
"chris.asaipillai@.gmail.com" wrote:
> We have created a SQL Server Job called 'Asynchronous Batch Agent'
> which is run Asynchronously on a set of databases each containing a
> batch.
> What I would like to do is to retrieve the Process ID of a particular
> instance of this agent when its being called and write that to a table
> with the ID for the individual database.
> Im having little luck at finding this information. I look at sp_who2
> and sysprocesses...but get a link to the job.
> Thanks for your help on this
> Chris
>
Retriveing the process ID for a SQL Server Agent job being run
which is run Asynchronously on a set of databases each containing a
batch.
What I would like to do is to retrieve the Process ID of a particular
instance of this agent when its being called and write that to a table
with the ID for the individual database.
Im having little luck at finding this information. I look at sp_who2
and sysprocesses...but get a link to the job.
Thanks for your help on this
Chris
Hi Chris,
Try @.@.spid, db_id() and db_name().
Hope this helps,
Ben Nevarez
"chris.asaipillai@.gmail.com" wrote:
> We have created a SQL Server Job called 'Asynchronous Batch Agent'
> which is run Asynchronously on a set of databases each containing a
> batch.
> What I would like to do is to retrieve the Process ID of a particular
> instance of this agent when its being called and write that to a table
> with the ID for the individual database.
> Im having little luck at finding this information. I look at sp_who2
> and sysprocesses...but get a link to the job.
> Thanks for your help on this
> Chris
>
Friday, March 9, 2012
retrieving agent id?
I have an application that creates a publication on the server, and
have multiple mobile devices creating annonymous subscriptions to that
publications. I need to write a report that checks if each device have
the replication synchronized successfully. I can run
distribution.dbo.sp_MSenum_merge or look into
distribution.dbo.MSmerge_history to get at the data for _all_
subscriptions to a given publication, but to look at a particular
subscription, I need to filter by either the subscriber_db or agent_id
column. The problem is, how do I get either one of these information
from the device? Or is there other way of retrieving the merge history
for a particular device/annonymous subscription?
Thanks in advance,
Harold<haroldsphsu@.gmail.com> wrote in message
news:1119475787.108503.99500@.g44g2000cwa.googlegro ups.com...
> Hi all,
> I have an application that creates a publication on the server, and
> have multiple mobile devices creating annonymous subscriptions to that
> publications. I need to write a report that checks if each device have
> the replication synchronized successfully. I can run
> distribution.dbo.sp_MSenum_merge or look into
> distribution.dbo.MSmerge_history to get at the data for _all_
> subscriptions to a given publication, but to look at a particular
> subscription, I need to filter by either the subscriber_db or agent_id
> column. The problem is, how do I get either one of these information
> from the device? Or is there other way of retrieving the merge history
> for a particular device/annonymous subscription?
> Thanks in advance,
> Harold
I don't know much about merge replication, but BOL suggests that you should
consider the SQL-DMO COM interface instead of using system stored
procedures - see "Introducing Replication Programming". In your specific
case, you might try the MergePublication object's EnumSubscriptions() and
EnumMergeAgentSessions() methods, although that's just a guess - your best
option might be to post in microsoft.public.sqlserver.replication
Simon