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

  • Home
  • SEARCH
  • 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 7794421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:46:14+00:00 2026-06-01T22:46:14+00:00

ALTER TRIGGER [dbo].[AlertMail_tr] ON [dbo].[MethodToLog_tbl] AFTER INSERT AS BEGIN DECLARE @LogId int SET @LogId

  • 0
ALTER TRIGGER [dbo].[AlertMail_tr]
ON 
[dbo].[MethodToLog_tbl]
AFTER INSERT 
AS      
BEGIN
DECLARE @LogId int
SET @LogId = (SELECT LogDataId FROM inserted)
if(SELECT Failure_flag FROM inserted)=1
begin
        exec [DB].[dbo].SendMail_prc
        @Command='EXEC CheckNew.dbo.FailureMail_prc @LogId'
        ,@MailPriority=1
        ,@MailRecipients='abc@xyz.com'
        ,@Subject='Alert-Failure'

end
END

I am getting this error :

Must declare scalar variable @LogId.

  • 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-01T22:46:17+00:00Added an answer on June 1, 2026 at 10:46 pm
    @Command='EXEC CheckNew.dbo.FailureMail_prc @LogId='+cast ( @LogId as nvarchar(100))
    

    or

    @Command='EXEC CheckNew.dbo.FailureMail_prc '+cast ( @LogId as nvarchar(100))
    

    Also ,

    put a Value in @LogId before you exec the string query.

    edit

    declare @tmp nvarchar(max)
    set @tmp='EXEC CheckNew.dbo.FailureMail_prc '+cast (@LogId as nvarchar(100))
    
    
    
     exec [DB].[dbo].SendMail_prc
            @Command=@tmp
            ,@MailPriority=1
            ,@MailRecipients='abc@xyz.com'
            ,@Subject='Alert-Failure'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have below trigger ALTER TRIGGER [dbo].[DeleteUserData] ON [dbo].[site_users] AFTER DELETE AS BEGIN SET
this is my trigger ALTER trigger [dbo].[addpay] on [dbo].[pays] after insert as declare @idtutor
ALTER TRIGGER t1 ON dbo.Customers FOR INSERT AS BEGIN TRANSACTION /* variables */ DECLARE
My trigger is as below , Alter TRIGGER [dbo].[LogTable_InsertTrigger] on [dbo].[std_table] AFTER INSERT as
I'm sending a demo trigger CREATE TRIGGER MyTestTrigger ON dbo.tblCursor AFTER INSERT AS Declare
I've got a trigger attached to a table. ALTER TRIGGER [dbo].[UpdateUniqueSubjectAfterInsertUpdate] ON [dbo].[Contents] AFTER
Let's say I've got a trigger like this: CREATE TRIGGER trigger1 ON [dbo].[table1] AFTER
I've got an after insert trigger that works well. However, I want it to
There is something wrong with this trigger. But what? CREATE TRIGGER MYCOOLTRIGGER AFTER INSERT
I need to trigger a block of code after 20 minutes from the AlarmManager

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.