On Feb 05, 2007, at 3:52 PM, Brad Weber wrote:
I'm trying to create a trigger in a REALSQLdatabase database and
having trouble. The error is 'near "SET": syntax error'. What am I
missing?
triggerStatement = "CREATE TRIGGER " + tableName + "_onInsert
BEFORE INSERT ON " + tableName _
+ " FOR EACH ROW BEGIN " _
+ " SET NEW.created = now();" _
+ " END"
db.SQLExecute(triggerStatement)
Brad Weber
Probably need to actually UPDATE a real table and not the NEW table
triggerStatement = "CREATE TRIGGER " + tableName + "_onInsert
BEFORE INSERT ON " + tableName _
+ " FOR EACH ROW BEGIN " _
+ " update " + tablename + " SET created = now()
where .... ;" <<<<<<<<<<< you'll need some criteria here maybe where
primary keys match
+ " END"
_______________________________________________
Unsubscribe:
<[EMAIL PROTECTED]>
REAL Software has decided to consolidate this mailing list with the online Forums.
On Monday, February 12, 2007, this mailing list will no longer be active. We
encourage you to continue your REALbasic and REAL SQL Server discussions on the
Forums. If you are not presently a member of the forum, please sign up today at
<http://forums.realsoftware.com>.