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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:06:20+00:00 2026-05-15T14:06:20+00:00

I need to create trigger in SQL Server 2008 that gone insert all values

  • 0

I need to create trigger in SQL Server 2008 that gone insert all values from one row in which some value was changed into Log table!

For example if i have table Employees that have column id, name , password, and i update this table and insert new value for column name, than i need to insert values that was in table Employees after update in table Log.

How I can do this? Thanks!

  • 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-15T14:06:21+00:00Added an answer on May 15, 2026 at 2:06 pm

    Here’s an example update trigger:

    create table Employees (id int identity, Name varchar(50), Password varchar(50))
    create table Log (id int identity, EmployeeId int, LogDate datetime, 
        OldName varchar(50))
    go
    create trigger Employees_Trigger_Update on Employees
    after update
    as
    insert into Log (EmployeeId, LogDate, OldName) 
    select id, getdate(), name
    from deleted
    go
    insert into Employees (Name, Password) values ('Zaphoid', '6')
    insert into Employees (Name, Password) values ('Beeblebox', '7')
    update Employees set Name = 'Ford' where id = 1
    select * from Log
    

    This will print:

    id   EmployeeId   LogDate                   OldName
    1    1            2010-07-05 20:11:54.127   Zaphoid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All we need is to create several pre-insert/update triggers in SQL Server 2008 R2
I need to create Trigger for delete action which backsup all fields old value
I need to create a trigger in SQL Server. Trigger works: If I found
I am going to create a DDL trigger to all databases in SQL Server
I need to create a SQL Server database that will recieve updates by some
I used SQL server 2008 script wizard to create a script that would recreate
I have MS SQL Server database and insert some values to one of the
I'm trying to create a database trigger in SQL Server 2008 for a tblCustomer
I have a SQL-CLR trigger in SQL Server 2008 that sends out message to
I need to create a Trigger that fires when a child record (Codes) is

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.