Welcome to Sign in | Help

Re: TIMESTAMP

  •  04-09-2008, 5:33 PM

    Re: TIMESTAMP

    Pai din aplicatia C# ar putea din greseala o anumita functie de SAVE sa faca un astfel de update pe toate articolele.
    Coduri din aplicatie nu pot publica pentru ca nu prea aj la ele :( ma ocup de SQL si cam atat.

    Eu zic ca este un scenariu curent.
    Cat desptre codul de SQL ... acesta este urmatorul.

    ALTER TABLE Participant ADD UltimaModificare DATETIME CONSTRAINT  Ultima_Default DEFAULT getdate()

    IF EXISTS (SELECT * FROM sysobjects
                WHERE id = OBJECT_ID(N'[dbo].[Participant_TRTimeStamp]')
                        AND type in (N'TR')
                )
        DROP TRIGGER [dbo].[Participant_TRTimeStamp]
    GO

    CREATE TRIGGER [dbo].[Participant_TRTimeStamp]
    ON [dbo].[Participant]
    AFTER UPDATE
    AS
    BEGIN
        UPDATE Participant SET UltimaModifcare = getdate()
        WHERE ID_Participant =
            (
                SELECT ID FROM INSERTED
            )
    END
    GO

    iar apoi am incercat cu UPDATE PArticipant SET Nume = 'x'
    Nu am index pe campul Nume pentru ca asta ar incetini si m mult



    MCP (C Sharp)
    Software Engineer,
    Cluj Napoca
View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems