[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

SQL Server polling and MSMQ

z1hou1

3/22/2007 4:44:00 AM

Hi,
I have a situation where I have to poll the SQL Server 2000 database
for certain rows with a particular status. I would like to avoid
polling, but for now it seems and easy way out.

Would it be possible for a trigger on the table to post a message on a
queue, in this case MSMQ and can T-SQL be used to poll the MSMQ?

Regards,
z1hou1

3 Answers

Mubashir Khan

3/22/2007 10:57:00 AM

0

this is exactly what i am planning to do in my future project.
i may provide you some info on this ...

you need to write a com wrapper around MSMQ api and use it in sql through
SP_OA procedures. Microsoft does provide com wrapper for msmq, i remember
sendmessage method expects variant type and i was unable to figure out what
sqltype to use for this ... so its better to write your own com.

secondly u should use MSMQ api or MSMQ COM provided by microsoft in ur
application and recieve messages asynchronously.

Do not use trigger to post message to msmq ... it is possible ... but it is
going to get troublesome... insert/update operations are going to get slower
and may fail ... intead make an sp to call com and call this sp from the
place records are inserted/updated if possible e.g. dts .... or make a sql
job to monitor records and call sp

add a requery time to ur app but a long interval .... say 10 mins ... so
that just in case there is some problem with msmq ... ur app is still
getting the record ... this is the contingency plan ....

<z1hou1@gmail.com> wrote in message
news:1174538615.510086.190230@p15g2000hsd.googlegroups.com...
> Hi,
> I have a situation where I have to poll the SQL Server 2000 database
> for certain rows with a particular status. I would like to avoid
> polling, but for now it seems and easy way out.
>
> Would it be possible for a trigger on the table to post a message on a
> queue, in this case MSMQ and can T-SQL be used to poll the MSMQ?
>
> Regards,
> z1hou1
>


Mubashir Khan

3/22/2007 11:28:00 AM

0

and if u will send message to msmq from tsql and receive messages in tsql
..... why msmq ...... use trigger approach to invoke an sql job
asynchronously ... i think u can use sqldmo com for this .... and there may
be some easier alternatives ....
"Mubashir Khan" <mubi@yahoo.com> wrote in message
news:uplNmDHbHHA.3616@TK2MSFTNGP05.phx.gbl...
> this is exactly what i am planning to do in my future project.
> i may provide you some info on this ...
>
> you need to write a com wrapper around MSMQ api and use it in sql through
> SP_OA procedures. Microsoft does provide com wrapper for msmq, i remember
> sendmessage method expects variant type and i was unable to figure out
> what sqltype to use for this ... so its better to write your own com.
>
> secondly u should use MSMQ api or MSMQ COM provided by microsoft in ur
> application and recieve messages asynchronously.
>
> Do not use trigger to post message to msmq ... it is possible ... but it
> is going to get troublesome... insert/update operations are going to get
> slower and may fail ... intead make an sp to call com and call this sp
> from the place records are inserted/updated if possible e.g. dts .... or
> make a sql job to monitor records and call sp
>
> add a requery time to ur app but a long interval .... say 10 mins ... so
> that just in case there is some problem with msmq ... ur app is still
> getting the record ... this is the contingency plan ....
>
> <z1hou1@gmail.com> wrote in message
> news:1174538615.510086.190230@p15g2000hsd.googlegroups.com...
>> Hi,
>> I have a situation where I have to poll the SQL Server 2000 database
>> for certain rows with a particular status. I would like to avoid
>> polling, but for now it seems and easy way out.
>>
>> Would it be possible for a trigger on the table to post a message on a
>> queue, in this case MSMQ and can T-SQL be used to poll the MSMQ?
>>
>> Regards,
>> z1hou1
>>
>
>


Hugo Kornelis

3/23/2007 11:38:00 PM

0

On Thu, 22 Mar 2007 06:27:59 -0500, Mubashir Khan wrote:

>and if u will send message to msmq from tsql and receive messages in tsql
>.... why msmq ...... use trigger approach to invoke an sql job
>asynchronously ... i think u can use sqldmo com for this .... and there may
>be some easier alternatives ....

Hi Mubashir,

When going from SQL to SQL, the easiest option would be to use Service
Broker. This does require SQL Server 2005, though.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hug...