

However, I believe that the trigger should return an error to the client. Add three columns (and add a space between them) into one 'Address' column: SELECT CONCATWS (' ', Address, PostalCode, City) AS Address. This would also only put one space if there was no middle name and a space before and after if there was a middle name.

Like so: SELECT CONCAT (fName1,COALESCE (CONCAT (' ',mName2,' '),' '),lName3) AS userName FROM users WHERE level > 10. INSERT INTO RawData (LineItemID, PreState,CtimeIn,CtimeOut,PostState,Name,Value) VALUES (NULL, '1','1131405338.64','1131405338.6416','','Enter','11')Īs a application developer, this problem can be fixed by correcting the trigger to be you could also the COALESCE () function to return the first non-null value. 'Coalesce' is the ANSI-standard function name, but ISNULL is easier to spell. The second should demonstrate the problem. SET Concatenated ISNULL (Column1, '') + ISNULL (Column2, '') If the value of the column/expression is indeed NULL, then the second value specified (here: empty string) will be used instead.

Instead, I believe that this trigger should error out under such a condition and return an error to the client.Ĭreate the tables listed in description. When the row contains a null value, FieldNameValues becomes null itself. However, The trigger has some abnormal behavior when we insert a row into RawData that contains a null value. Normally, when you insert a row into rawData, you get a trigger that inserts a row into ReplicationLog with a fieldNamevalues looking something like this In addition, I have the following trigger that occurs after RawData inserts: TableName varchar(64) NOT NULL default '', PostState varchar(100) NOT NULL default '', PreState varchar(100) NOT NULL default '', LineItemID int(10) unsigned default NULL,ĬtimeIn varchar(100) NOT NULL default '',ĬtimeOut varchar(100) NOT NULL default '', ID int(10) unsigned NOT NULL auto_increment,
