Log changes to text file fromtrigger

  • Hi Sql server2k friends

    I wants to know that is it possible to log the changes to a table can be logged to a text file

    instead of other table.

    If yes please tell me the syntax to open the text file and log changes and close the file

    Thanks and Regards.

    Sumesh

     

     

     

  • There is no standard command for logging DataModelingLanguage-statements.

    If you mean datachanges, you could periodically start a job that would write data from the auditing table to a file.

  • Hi Jo

    Thanks for you reply

    Then can u give  me the syntax how to make a

    string of all the fields data by concate and place it in a single string or varchar field of auditing table. This will also very useful for me

    Regards

    Sumesh

  • Mostly we create a Trigger on a table:

    Table Original

    Column1 (PK)

    Column2

    Table History

    Column1

    Column2

    ChangedDate

    ChangedUser

     

    CREATE TRIGGER TR_ORIGINAL_INSERT ON dbo.Original

    FOR INSERT /*INSERTS ONLY*/

    INSERT INTO dbo.HISTORY

    (column1,column2,ChangedDate,ChangedUser)

    SELECT Column1,Column2,CURRENT_TIMESTAMP,CURRENT_USER

    from inserted.column1,inserted.column2

    Your application can read out the columns and concatenate them

  • Hi Jo

    Thanks once again

    My actual problem is i have puchased readymade

    ERP s/w and there are around 1500 tables in the

    database and i wants to track the table changes

    step by step after executing steps in a process like create, process, book, close purchase order . can u suggest me solution for this that

    how i can track changes in database after each step.

    Thanks& Regards

    Sumesh

     

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply