WaitForSingleObject Event Thrown from Sql Server

B

Bill Sonia

Hello,

I have a Widnows Service that creates a system event that I would like
to have a Sql Server stored procedure fire when the stored procedure is
called. I have a Windows Service that runs on my database server that
will wait for this event before it will execute (via the
Win32.CreateEvent and Win32.WaitForSingleObject). The trouble I'm
having is actually throwing the event from inside a Sql Server Stored
Procedure.

Any ideas how I can call Win32.SetEvent(EventName) from inside a Sql
Server Stored Procedure?

Thanks,

~Bill

________________________
Bill Sonia
Achaia Solutions, Inc
www.achaiasolutions.com
 
K

Kevin Yu [MSFT]

Hi Bill,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
S

Sami Vaaraniemi

Bill Sonia said:
Hello,

I have a Widnows Service that creates a system event that I would like
to have a Sql Server stored procedure fire when the stored procedure is
called. I have a Windows Service that runs on my database server that
will wait for this event before it will execute (via the
Win32.CreateEvent and Win32.WaitForSingleObject). The trouble I'm
having is actually throwing the event from inside a Sql Server Stored
Procedure.

Any ideas how I can call Win32.SetEvent(EventName) from inside a Sql
Server Stored Procedure?

Thanks,

~Bill

There are at least a couple of ways to do this.

You could write a COM component (or a managed component and expose it as a
COM component) and have it call SetEvent. You can then call the COM
component from the SQL stored procedure. However, calling a COM component
from SQL does not give you great performance in case that is an issue.

Another way to do this would be by writing an extended stored procedure and
having it call SetEvent. Calling an extended stored procedure from SQL is
faster than the COM way. You'll find documentation on extended stored
procedures on MSDN.

Regards,
Sami
 
J

Jeffrey Tan[MSFT]

Hi Bill,

I agree with Sami that "Extended Stored Procedure" should meet your need,
because it is a dll, you may call Win32 API as you want.

For more information, please refer to:
"HOW TO: Use Extended Stored Procedures"
http://support.microsoft.com/default.aspx?scid=kb;EN-US;190987

and
"Extended Stored Procedures: Intro And 10 Cool Examples"
http://www.devarticles.com/c/a/SQL-Server/Extended-Stored-Procedures-Intro-A
nd-10-Cool-Examples/

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
B

Bill Sonia

Thanks Sami, this is exactly what I am looking for. I think extended
stored procedures will have many more uses for me down the road. It
seems they give me the 'outside sql server' environment control I need
for my data-driven apps.

Big help!!

Thanks,

~Bill

________________________
Bill Sonia
Achaia Solutions, Inc
www.achaiasolutions.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top