BACKUP TABLE(historical)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fernand St-Georges

    BACKUP TABLE(historical)

    How to build a TRIGGER that copies, all the time, the data from the table on
    which the transaction occurs to the historical table?
    thanks

    Fernand


    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.659 / Virus Database: 423 - Release Date: 2004-04-15




  • Fernand St-Georges

    #2
    Re: BACKUP TABLE(historica l) FOUND OUT BY MYSELF

    /* INSCRIRE LA DATE DU JOUR LORS DE LA MODIFICATION D'UN TEXTE */

    CREATE TRIGGER maj_texte ON dbo.TEXTES

    FOR INSERT, UPDATE, DELETE

    as

    DECLARE @ident_text INT



    SELECT @ident_text = ID_TEXTE

    FROM deleted TEXTES

    UPDATE TEXTES

    SET DATE_JOUR_USAGE R = CURRENT_TIMESTA MP

    FROM [TEXTES]

    where ID_TEXTE = @ident_text

    /* INSCRIRE LES DONNÉES HISTORIQUES DANS LA TABLE DE CONTRÔLE DE TEXTE */

    INSERT INTO [CONTROLE_TEXTE]

    (ID_TEXTE, STATUT, DATE_CREATION, DATE_MODIFICATI ON,DATE_MISE_A_ JOUR,
    DATE_TOMBER, DATE_EXPIRATION , DATE_JOUR_USAGE R, TITRE, SOUS_TITRE,
    INTRODUCTION, TEXTE, AUTEUR, VERROUILLER, TEMPLATE, ID_LANGUE, ID_IMAGE,
    ID_SECTION_SITE )

    SELECT ID_TEXTE, STATUT, DATE_CREATION, DATE_MODIFICATI ON, DATE_MISE_A_JOU R,
    DATE_TOMBER, DATE_EXPIRATION , DATE_JOUR_USAGE R, TITRE, SOUS_TITRE,
    INTRODUCTION, TEXTE, AUTEUR, VERROUILLER, TEMPLATE, ID_LANGUE, ID_IMAGE,
    ID_SECTION_SITE

    FROM inserted TEXTES

    "Fernand St-Georges" <fernand.st-georges@videotr on.ca> a écrit dans le
    message de news: Swbhc.1392$Iu5. 44290@weber.vid eotron.net...[color=blue]
    > How to build a TRIGGER that copies, all the time, the data from the table[/color]
    on[color=blue]
    > which the transaction occurs to the historical table?
    > thanks
    >
    > Fernand
    >
    >
    > ---
    > Outgoing mail is certified Virus Free.
    > Checked by AVG anti-virus system (http://www.grisoft.com).
    > Version: 6.0.659 / Virus Database: 423 - Release Date: 2004-04-15
    >
    >
    >
    >[/color]


    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.659 / Virus Database: 423 - Release Date: 2004-04-15


    Comment

    Working...