Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8106501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:29:21+00:00 2026-06-06T00:29:21+00:00

I written a trigger on smslog table ALTER TRIGGER [dbo].[mytrigger] ON [dbo].[smslog] AFTER INSERT

  • 0

I written a trigger on smslog table

ALTER TRIGGER [dbo].[mytrigger]    
   ON  [dbo].[smslog]   
   AFTER INSERT    
AS   
   Declare @MobileNo int   
   Declare @smstext as varchar(300)   
Begin    
   set @MobileNo = ( select mobile from inserted)  
   set @smstext = (select smstext from inserted)  
   set @sResponse = 'test'
   Exec pr_SendSmsSQL @MobileNo, @smstext, @sResponse  
END  

Stored procedure is

create procedure [dbo].[pr_SendSmsSQL] 
    @MobileNo varchar(12), 
    @smstext as varchar(300), 
    @sResponse varchar(1000) OUT 
as 
BEGIN 
   Declare @iReq int,@hr int 
   Declare @sUrl as varchar(500) 
   DECLARE @errorSource VARCHAR(8000)
   DECLARE @errorDescription VARCHAR(8000) 

   -- Create Object for XMLHTTP 
   EXEC @hr = sp_OACreate 'Microsoft.XMLHTTP', @iReq OUT 

   print @hr 

   if @hr <> 0 
      Raiserror('sp_OACreate Microsoft.XMLHTTP FAILED!', 16, 1) 

   set @sUrl='http://api.clickatell.com/http/sendmsg?user=devendar&password=csx19csx&api_id=3360313&to=#MobNo#&text=#Msg#' 

   set @sUrl=REPLACE(@sUrl,'#MobNo#',@MobileNo) 
   set @sUrl=REPLACE(@sUrl,'#Msg#',@smstext) 

   print @sUrl 

   -- sms code start 
   EXEC @hr = sp_OAMethod @iReq, 'Open', NULL, 'GET', @sUrl, true 
   print @hr 

   if @hr <> 0 
      Raiserror('sp_OAMethod Open FAILED!', 16, 1) 

   EXEC @hr = sp_OAMethod @iReq, 'send' 
   select @iReq
   print @hr 

   if @hr <> 0 
   Begin 
       EXEC sp_OAGetErrorInfo @iReq, @errorSource OUTPUT, @errorDescription OUTPUT

       SELECT [Error Source] = @errorSource, [Description] = @errorDescription

       Raiserror('sp_OAMethod Send FAILED!', 16, 1) 
   end 
else 
Begin
    EXEC @hr = sp_OAGetProperty @iReq,'responseText', @sResponse OUT 
    print @hr

    insert into send_log (Id, mobile, sendtext, response, created, createddate) 
    values(0, @MobileNo, @smstext, @sResponse, 'System', GETDATE())
end
end

I use clickatell gateway here please help me on this what is the issue

I am not able to send SMS when I insert a row into the smslog table

I used after insert in trigger and passed parameters to stored procedure to send SMS.

Please help me on this

Thanks in Advance
devendar

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:29:25+00:00Added an answer on June 6, 2026 at 12:29 am
    ALTER TRIGGER [dbo].[mytrigger]    
       ON  [dbo].[smslog]   
       AFTER INSERT    
    AS   
       Declare @MobileNo int   
       Declare @smstext as varchar(300)   
    Begin    
       set @MobileNo = ( select mobile from inserted)  
       set @smstext = (select smstext from inserted)  
       set @sResponse = 'test'
       Exec pr_SendSmsSQL @MobileNo, @smstext, @sResponse  
    END  
    

    Procedure

    create procedure [dbo].[pr_SendSmsSQL] 
        @MobileNo varchar(12), 
        @smstext as varchar(300), 
        @sResponse varchar(1000) OUT 
    as 
    BEGIN 
       Declare @iReq int,@hr int 
       Declare @sUrl as varchar(500) 
       DECLARE @errorSource VARCHAR(8000)
       DECLARE @errorDescription VARCHAR(8000) 
    
       -- Create Object for XMLHTTP 
       EXEC @hr = sp_OACreate 'Microsoft.XMLHTTP', @iReq OUT 
    
       print @hr 
    
       if @hr <> 0 
          Raiserror('sp_OACreate Microsoft.XMLHTTP FAILED!', 16, 1) 
    
       **set @sUrl='http://api.clickatell.com/http/sendmsg?user=devendar&password=csx19csx&api_id=3360313&to=#MobNo#&text=#Msg#'** 
    

    **
    THe APi isnot working properly – remaining code is excellent it working in a great way
    **

       set @sUrl=REPLACE(@sUrl,'#MobNo#',@MobileNo) 
       set @sUrl=REPLACE(@sUrl,'#Msg#',@smstext) 
    
       print @sUrl 
    
       -- sms code start 
       EXEC @hr = sp_OAMethod @iReq, 'Open', NULL, 'GET', @sUrl, true 
       print @hr 
    
       if @hr <> 0 
          Raiserror('sp_OAMethod Open FAILED!', 16, 1) 
    
       EXEC @hr = sp_OAMethod @iReq, 'send' 
       select @iReq
       print @hr 
    
       if @hr <> 0 
       Begin 
           EXEC sp_OAGetErrorInfo @iReq, @errorSource OUTPUT, @errorDescription OUTPUT
    
           SELECT [Error Source] = @errorSource, [Description] = @errorDescription
    
           Raiserror('sp_OAMethod Send FAILED!', 16, 1) 
       end 
    else 
    Begin
        EXEC @hr = sp_OAGetProperty @iReq,'responseText', @sResponse OUT 
        print @hr
    
        insert into send_log (Id, mobile, sendtext, response, created, createddate) 
        values(0, @MobileNo, @smstext, @sResponse, 'System', GETDATE())
    end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Will an AFTER INSERT trigger (function written in pl/PGsql) fire in a separate transaction
Recently, I encountered a BEFORE INSERT OR UPDATE trigger on a table. In this
I have a table for which i have written a trigger: CREATE OR REPLACE
I've written a trigger. USE [TEST] GO /****** Object: Trigger [dbo].[TR_POSTGRESQL_UPDATE_YC] Script Date: 05/26/2010
I have written a toolbar that runs on the taskbar. Unfortunately, after it is
I have written an update trigger, that does an update that could potentially call
I have following trigger written for my application which gives me this error Msg
I have written an update trigger which works fine when i update only one
I have written a trigger that I want to use for adding the date
I have written the following trigger in SQL server: create trigger test_trigger on invoice

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.