We use OLE Automation methods such as SP_OAmethod, Sp_Oacreate, etc.. to send SMS to users from SQL Server. I wish to stop use OLE Automation. Is there any alternate way to send SMS?
1 Answer
Is there any way to send SMS without OLE Automation?
You can write your own C# solution using CLR and deploy it to SQL Server, such as a CLR procedure. Doing so will allow you to (either directly or indirectly via web service calls) leverage other already built frameworks for sending out SMS messages.
CLR is a rather standard way to implement logic that is outside the scope of T-SQL, that can be executed within SQL Server via T-SQL code, stored within T-SQL-like objects.
-
1But why do it from SQL Server at all? Why not do it from some C# client app, or from a Powershell script?Charlieface– Charlieface2024-03-02 20:36:31 +00:00Commented Mar 2, 2024 at 20:36
-
@Charlieface Good questions for OP eh? 😉J.D.– J.D.2024-03-03 18:40:58 +00:00Commented Mar 3, 2024 at 18:40
-
@J.D. Thank you for your Solution, Well Actually I'm a DBA, I am not sure how C# developers use sp_OAmethod to send SMS. I'll inform this to C# Developers to change their code.dbajayy– dbajayy2024-03-04 04:53:08 +00:00Commented Mar 4, 2024 at 4:53
-
@dbajayy "I am not sure how C# developers use sp_OAmethod to send SMS." - They don't. Instead, they can send SMS messages in C# through a multitude of other methods, that are easier and more resilient to code with. But depending on how it's coded, the C# code can essentially be deployed as its own stored procedure on SQL Server, if that's where you need to execute the code from.J.D.– J.D.2024-03-04 13:44:54 +00:00Commented Mar 4, 2024 at 13:44