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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:48:09+00:00 2026-05-25T09:48:09+00:00

I created two triggers already: create trigger [insert_history] on users for insert as insert

  • 0

I created two triggers already:

create trigger [insert_history] on users
for insert
as
insert audit(action_type, table_name, object_name, time)
select 'Inserted', 'users', username, getdate()
from inserted

go

create trigger [update_history] on users
for update
as
insert audit(action_type, table_name, object_name, time)
select 'Updated', 'users', username, getdate()
from deleted

Inserted retrieves value from inserated.
Update retrieves value from deleted.

What about delete statement?

  • 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-05-25T09:48:10+00:00Added an answer on May 25, 2026 at 9:48 am

    That would use the deleted pseudotable too.

    It could be incorporated with your update trigger using for update, delete as your update trigger only includes the “before” values so the code for both would be the same currently.

    Edit: Though then your trigger would need to check if EXISTS(SELECT * FROM inserted) to determine the action string so maybe separate would be easier.

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

Sidebar

Related Questions

I am newbie in SQL.I am reading Triggers created two trigger on a table.Below
There are two Table Table_Trigger and Table_Trigger1 .I have created a trigger on Table_Trigger1
I have two tables t1 and t2. i have created two triggers tr1 after
I would like to know if its possible to create two triggers, one on
I created two tables: Publisher PK, PublisherId, int, not null, indentity +1 PublisherName, varchar(50),
I created two files in the App_GlobalResources folder: SiteResources.en-US.resx SiteResources.sp-SP.resx Both contain a value
I created two very simple Heroku apps to test out the service, but it's
I've created two functions to load expanded views of a month in the archive
I've created two classes, with one of them having an implicit cast between them:
I have created two forms in my Windows Application. One Form acts as a

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.