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 8592061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:39:55+00:00 2026-06-11T23:39:55+00:00

I am using SQL Server 2008. My trigger shown below. And I am inserting

  • 0

I am using SQL Server 2008. My trigger shown below. And I am inserting the values I didn’t get any update in two tables .

 CREATE TRIGGER trgAfterInserta ON AMS_33.dbo.access_event_logs
 AFTER INSERT,UPDATE 
 AS           
        declare @idams bigint;  
        declare @id int; 
        declare @uid nvarchar(20);
        declare @tentry datetime;
        declare @tsn nvarchar(20);
        declare @evtid nvarchar(20);
        declare @audit_action nvarchar(300);

select @idams   = i.id from inserted i;
select @id      =  max(Rownumber) + 1   from   TAV3.dbo.access_event_logs ;  
select @uid    =i.USERID from inserted i;   
select @tentry =i.TIMESTAMPS from inserted i;   
select @tsn   =i.TERMINALSN from inserted i;
select @evtid =i.EVENTID from inserted i;
set    @audit_action='Inserted Record -- After Insert.';
set    @tentry = dateadd(hh,3,@tentry); 


insert into TAV3.dbo.access_event_logs 
(Rownumber,Userid, Timeentry, Eventid, Terminalsn, Notes)
 values(@id,@uid, @tentry, @evtid, @tsn, @audit_action);

update AMS_33.dbo.access_event_logs set Calculated=1 where id= @idams;  

GO

Table 1 AMS_33.dbo.access_event_logs

  id    bigint  Unchecked
  USERID    nvarchar(50)    Unchecked
  DEPARTMENT    nvarchar(50)    Unchecked
  TIMESTAMPS    datetime    Unchecked
  EVENTID   nvarchar(50)    Unchecked
  TERMINALSN    nvarchar(50)    Unchecked
  ACCESSMETHOD  nvarchar(255)   Unchecked
  REMARKS   nvarchar(255)   Unchecked
  TERMINALIP    nvarchar(50)    Unchecked
  PHOTO image   Checked
  PHOTOSIZE int Unchecked
  RECLOGDTM datetime    Unchecked
  RECLOGFROMIP  nvarchar(50)    Unchecked
  LOCALTIMESTAMP    datetime    Unchecked
  PhotoPath nvarchar(50)    Checked
  Calculated    int Checked

Table 2 TAV3.dbo.access_event_logs

Rownumber   int Unchecked
Userid  nvarchar(20)    Unchecked
Timeentry   datetime    Unchecked
Eventid nvarchar(20)    Checked
Terminalsn  nvarchar(20)    Unchecked
Calculated  int Checked
Notes   nvarchar(300)   Checked

Here no insert or update is performing ?

  • 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-11T23:39:56+00:00Added an answer on June 11, 2026 at 11:39 pm

    You are assuming only one row has been inserted or updated, in statements like
    select @idams = i.id from inserted i;

    That could be false. Those statement would then fail never getting to the insert

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using SQL Server 2008 R2. I have two tables, ShoppingList and ShoppingListFood
Is there a way to synchronize two SQL Server 2008 databases(any edition) using Microsoft
I'm using SQL Server 2008. I'm creating a DDL trigger like this: CREATE TRIGGER
I am using SQL Server 2008 R2, I have a script to update the
I have SQL Server 2008 database with two tables. The first table is called
I'm trying to create a simple trigger using TSQL (or SQL Server 2008). The
(Using SQL Server 2008) I could easily get this to work if I built
I have an on update trigger in SQL Server 2008. I only need to
Using SQL Server 2008 R2 we are looking for a way to select the
Using SQL Server 2008. I have multiple Locations which each contain multiple Departments which

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.