SQL command to send infomessage to users

Posted on 2009-04-21
Last Modified: 2012-05-06
Is there a command in MSSQL that will allow me to send a message to connected users? I see that the SqlConnection class in C# has an InfoMessage event, I just need to be able to send the message from the server in a stored procedure. I'm guessing this is pretty easy, but I tried googling this and all I found were people trying to send emails from stored procedures.

Question by:dcollins2010
    LVL 75

    Accepted Solution

    >>Is there a command in MSSQL that will allow me to send a message to connected users?<<
    No, there is not.

    Author Comment

    Well is there any code that I can use to prod the users, as a trigger to check for changes? I was going to use Query notifications but those seem to only work with direct SQL queries, whereas I'm using stored procedures, and I also want to explicitly trigger the notifications rather than rely on MSSQL to implicitly send them. I also read that SQL notifications were meant for services monitoring the server, not client applications connected to the server.
    LVL 75

    Expert Comment

    by:Anthony Perkins
    You will have to write your own code to do that in your application.  From SQL alone, the best you can do is add T-SQL code to send an email notifying the change.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
    'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
    Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
    Via a live example, show how to shrink a transaction log file down to a reasonable size.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now