Results 1 to 5 of 5

Thread: Is a trigger the best way to go [Resolved]

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    262

    Resolved Is a trigger the best way to go [Resolved]

    Hi, we have one local copy of a table stored in SQL Server and one website copy of a table stored in MySQL.
    At the end of the night I want all changes to the SQL server updated to the website on this table.
    I thought in my very limited knowledge that a trigger might be the way to go. The trigger would tell me which SQL Server columns had been changed as follows

    Code:
    Create trigger dbo.testtrig on dbo.employees for update
    as
    begin
    declare @empid int
    declare @webup bit
    set @webup = (select Webupdate from inserted)
    If  @webup = 0
    
    set @empid = (select employeesID from inserted)
    update employees set webupdate = 1 where employeesID = @empid
    end
    I'd then just update the columns that had 1 for webupdate.
    Does this make sense, or is this a crazy way to do things.
    Basically does the above trigger look correct and what improvments can I make or a better way of doing the same thing would be good.
    Last edited by Oliver1; Jan 17th, 2006 at 12:20 PM. Reason: Typo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width