MySQL Forums
Forum List  »  Microsoft SQL Server

Re: can't triggers reference to tables?
Posted by: Mike Kruckenberg
Date: June 25, 2005 08:23AM

The documentation says that you cannot reference tables, but that restriction was lifted in 5.0.3 and it is now possible.

I can see one obvious problem in this statement:

UPDATE _Attachments SET
RelAttNumber = INSERTED.AttNumber
FROM INSERTED
WHERE INSERTED.AttachmentCode = _Attachments.AttachmentCode;

INSERTED is a special SQLServer table used to store the incoming record. The way you reference the incoming record in MySQL is by the NEW keyword. Your statement should look something like this in MySQL:

UPDATE _Attachments SET
RelAttNumber = NEW.AttNumber
WHERE NEW.AttachmentCode = _Attachments.AttachmentCode;

Hope that helps.

Mike Kruckenberg
Co-author of Pro MySQL (Apress)
http://mike.kruckenberg.com

Options: ReplyQuote


Subject
Written By
Posted
Re: can't triggers reference to tables?
June 25, 2005 08:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.