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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:05:08+00:00 2026-06-15T09:05:08+00:00

This trigger backs up data from dbo.node to dbo.nodearchive. While backups are important, I

  • 0

This trigger backs up data from dbo.node to dbo.nodearchive. While backups are important, I only need to do this once per day. Note that there is a field called dbo.NodeArchive.versionDate (smalldDatetime).

CREATE TRIGGER [dbo].[Node_update] 
ON  [dbo].[Node]
for UPDATE

AS 
BEGIN
INSERT INTO dbo.NodeArchive ([NodeID]
  ,[ParentNodeID]
  ,[Slug]
  ,[xmlTitle]
...    
  ,[ModifyBy]
  ,[ModifyDate]
  ,[CreateBy]
  ,[CreateDate])

SELECT [deleted].[NodeID]
  ,[deleted].[ParentNodeID]
  ,[deleted].[Slug]
  ,[deleted].[xmlTitle]
...  
  ,[deleted].[ModifyBy]
  ,[deleted].[ModifyDate]
  ,[deleted].[CreateBy]
  ,[deleted].[CreateDate]
FROM  [deleted] LEFT JOIN dbo.Node
ON  [deleted].NodeID = dbo.Node.NodeID
WHERE deleted.ModifyDate <> dbo.Node.ModifyDate
END
GO

I am looking to backup changes, but never more than one backup version per day. If there is no change, there is no backup.

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

    That’s not a trigger anymore – that’ll be a scheduled job. Triggers by their very definition execute whenever a given operation (INSERT, DELETE, UPDATE) happens.

    Use the SQL Server Agent facility to schedule that T-SQL code to run once per day.

    Read all about SQL Server Agent Jobs in the SQL Server Books Online on MSDN

    Update: so if I understand correctly: you want to have an UPDATE trigger – but that trigger would only record the NodeID that were affected, into a “these nodes need to be backed up at night” sort of table. Then, at night, you would have a SQL Agent Job that runs and that scans that “work table” and for all NodeID values stored in there, it would then execute that T-SQL statement to copy their data into the NodeArchive table.

    With this approach, if your nodes with NodeID = 42 changes ten times, you’ll still only have a single entry NodeID = 42 in your work table, and the nightly backup job would then copy that node only once into the NodeArchive.

    With this approach, you can decouple the actual copying (which might take time) from the update process. The UPDATE trigger only records which NodeID rows need processing – the actual processing then happens sometime later, at an off-peak hour, without disturbing users of your system.

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

Sidebar

Related Questions

Let's say I've got a trigger like this: CREATE TRIGGER trigger1 ON [dbo].[table1] AFTER
Does this mean I can't update another table from a trigger if I'm using
we have the need to export a csv-file comprising data from the model from
Why does this trigger work (Changing the foreground of the button to Red when
I have this trigger which works functionally (as far as I can tell by
There is something wrong with this trigger. But what? CREATE TRIGGER MYCOOLTRIGGER AFTER INSERT
I am trying to update a table according to this trigger: CREATE TRIGGER alert
I'm using SQL Server 2008. I'm creating a DDL trigger like this: CREATE TRIGGER
My trigger takes an input. (NEW:input_id) With this input, it will generate new ID's
I have a trigger that looks something like this: create or replace TRIGGER cluster_check

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.