Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Send SMS from a trigger


Send SMS from a trigger

Author
Message
Al Siks
Al Siks
Grasshopper
Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)

Group: General Forum Members
Points: 18 Visits: 27
Comments posted to this topic are about the item Send SMS from a trigger


Got SQL Server? Manage It with Siccolo
Tom Munghono
Tom Munghono
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 7
I found your article quite interesting int approach to using SQL svr as a broadcast point. Thanx.
xuyendarling2006
xuyendarling2006
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 1
Hi. I'm from VietNam. I've read your article and very excited about it. But when I do like you, I can't send a message to a mobiphone or e-mail. I think your SMS provider's rules not suitable to my country but I can't solve that problem. Can you help me? Phone number in my country have format like 840958149760. 84 is the code of my country. 095 is the code of the provider. 8149760 is the phone number. Smile. Can you contact with me throught my e-mail (kimxuyen.it@gmail.com) or yahooID: kimxuyenit? Thanks!
MackamMagic
MackamMagic
SSC-Enthusiastic
SSC-Enthusiastic (118 reputation)SSC-Enthusiastic (118 reputation)SSC-Enthusiastic (118 reputation)SSC-Enthusiastic (118 reputation)SSC-Enthusiastic (118 reputation)SSC-Enthusiastic (118 reputation)SSC-Enthusiastic (118 reputation)SSC-Enthusiastic (118 reputation)

Group: General Forum Members
Points: 118 Visits: 3
Need to be pretty careful with this trigger.

Consider if the call to exec master.xp_sendMail .... fails.

This is a trigger - an error will cause an automatic rollback of the transaction in which the trigger was fired. Not only will the email/sms not be send but also the action which caused it to be raised - i.e. the insert into the table will not happen. If this insert was called from e.g. a stored proc then whatever was in there would also roll back.

I had a very similar problem many moons ago with a USERS table for a web site that had a trigger to send a rgistration email - lo and behold if exchange falls over or we can't connect to it then not only do they not receive their registration email but they also don't get registered on the site - i.e. no row appears in the USERS table. Very dangerous.



MackamMagic
MackamMagic
SSC-Enthusiastic
SSC-Enthusiastic (118 reputation)SSC-Enthusiastic (118 reputation)SSC-Enthusiastic (118 reputation)SSC-Enthusiastic (118 reputation)SSC-Enthusiastic (118 reputation)SSC-Enthusiastic (118 reputation)SSC-Enthusiastic (118 reputation)SSC-Enthusiastic (118 reputation)

Group: General Forum Members
Points: 118 Visits: 3
Oh and btw SQL 2005's database mail is now asynchronous therefore we no longer have the same issue in 2005.



roy.it2007
roy.it2007
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 0
.... i m an pl/sql developer
working for a coperative banks

now the bank pepoles want to send sms to their customer when they do some transaction
whether it is credited or debited

.. bank is using a oracle database to store the information
about all transaction and using window OS
after every transaction it insert a row in a dotr010 (transaction table)

sir i had developed a standalone software to send sms usning AT commands in VB 6.0

but sir it is not automatically trigger a sms to customer this utility not send sms untill it is not run by bank pepoles

i need your help
my banking software is completely
window based

i need ur help to get know
1. how to communicate GSM modem through oracle (procedure,pl/sql)
2. how the sms is triggered when one row is inserted in a transaction tabel
3. and how to maintain log file

this all only by using oracle no interface

thanks for kind time
i hope you pepole reply soon
i need it

regard
atul
Jack Corbett
  Jack Corbett
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16012 Visits: 14866
I just want to mention that I agree with MackamMagic, that you need to be very careful when doing something like this in a trigger, in fact I recommend against it, although as MackamMagic also mentions this is not as much an issue with SQL Server 2005. If you need to do any action outside the database I recommend queuing the data using a trigger and have a job or windows service that does the action.

The other thing is that are you sure you only want to send an email or SMS out when only 1 row is updated? At the least shouldn't someone be notified that a mass update was done?



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
bsr.anwar
bsr.anwar
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 0
I created the trigger successfully but when I tried to update the table the query doesn't execute it prints out
error stating that
Msg 15281, Level 16, State 1, Procedure xp_sendmail, Line 1
SQL Server blocked access to procedure 'sys.xp_sendmail' of component 'SQL Mail XPs' because this component is
turned off as part of the security configuration for this server. A system administrator can enable the use of 'SQL
Mail XPs' by using sp_configure. For more information about enabling 'SQL Mail XPs', see "Surface Area
Configuration" in SQL Server Books Online.
Any help would be more appreciated am beginner to sqlserver
Jack Corbett
  Jack Corbett
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16012 Visits: 14866
bsr.anwar (5/8/2014)
I created the trigger successfully but when I tried to update the table the query doesn't execute it prints out
error stating that
Msg 15281, Level 16, State 1, Procedure xp_sendmail, Line 1
SQL Server blocked access to procedure 'sys.xp_sendmail' of component 'SQL Mail XPs' because this component is
turned off as part of the security configuration for this server. A system administrator can enable the use of 'SQL
Mail XPs' by using sp_configure. For more information about enabling 'SQL Mail XPs', see "Surface Area
Configuration" in SQL Server Books Online.
Any help would be more appreciated am beginner to sqlserver


You shouldn't be using SQL Mail you should be using Database Mail.



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search