Hi Paul, I am getting below error while executing the trigger you shared. May be because of new FB version? I am executing using FlamRobin tool. Please see error below: *** IBPP::SQLException ***Context: Statement::Prepare( create trigger before update on Table_Nameasbeginif (new.col3 is distinct from old.col3)then new.col5 = current_timestamp )Message: isc_dsql_prepare failed SQL Message : -104can't format message 13:896 -- message file C:\Windows\system32\firebird.msg not found Engine Code : 335544569Engine Message :Dynamic SQL ErrorSQL error code = -104Token unknown - line 1, column 23update
On Wednesday, 9 August 2017 3:15 PM, "Paul Vinkenoog p...@vinkenoog.nl [firebird-support]" <firebird-support@yahoogroups.com> wrote: Hello Vishal, > I have one table say "MyTable", which has five columns, say Col1, > Col2,...,Col5 and it has 10 rows. Col5 is of Timestamp. > > My issue is, whenever I am updating Col3, that time, only for that row > of Col5, Timestamp value should be updated to the current timestamp. > > What would be the best option for this? > > If trigger is the best way then how would I do it? As I never worked > on Triggers. Yes, a trigger is definitely the way to go, e.g. like this: set term #; create trigger before update on MyTable as begin if (new.col3 is distinct from old.col3) then new.col5 = current_timestamp; end# set term ;# If col3 is non-nullable you can simply use "new.col3 <> old.col3" in the test. Mind you, an explicit update that re-enters the existing value in col3 won't cause col5 to be updated! HTH, Paul Vinkenoog #yiv6715055271 #yiv6715055271 -- #yiv6715055271ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv6715055271 #yiv6715055271ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv6715055271 #yiv6715055271ygrp-mkp #yiv6715055271hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv6715055271 #yiv6715055271ygrp-mkp #yiv6715055271ads {margin-bottom:10px;}#yiv6715055271 #yiv6715055271ygrp-mkp .yiv6715055271ad {padding:0 0;}#yiv6715055271 #yiv6715055271ygrp-mkp .yiv6715055271ad p {margin:0;}#yiv6715055271 #yiv6715055271ygrp-mkp .yiv6715055271ad a {color:#0000ff;text-decoration:none;}#yiv6715055271 #yiv6715055271ygrp-sponsor #yiv6715055271ygrp-lc {font-family:Arial;}#yiv6715055271 #yiv6715055271ygrp-sponsor #yiv6715055271ygrp-lc #yiv6715055271hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv6715055271 #yiv6715055271ygrp-sponsor #yiv6715055271ygrp-lc .yiv6715055271ad {margin-bottom:10px;padding:0 0;}#yiv6715055271 #yiv6715055271actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv6715055271 #yiv6715055271activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv6715055271 #yiv6715055271activity span {font-weight:700;}#yiv6715055271 #yiv6715055271activity span:first-child {text-transform:uppercase;}#yiv6715055271 #yiv6715055271activity span a {color:#5085b6;text-decoration:none;}#yiv6715055271 #yiv6715055271activity span span {color:#ff7900;}#yiv6715055271 #yiv6715055271activity span .yiv6715055271underline {text-decoration:underline;}#yiv6715055271 .yiv6715055271attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv6715055271 .yiv6715055271attach div a {text-decoration:none;}#yiv6715055271 .yiv6715055271attach img {border:none;padding-right:5px;}#yiv6715055271 .yiv6715055271attach label {display:block;margin-bottom:5px;}#yiv6715055271 .yiv6715055271attach label a {text-decoration:none;}#yiv6715055271 blockquote {margin:0 0 0 4px;}#yiv6715055271 .yiv6715055271bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv6715055271 .yiv6715055271bold a {text-decoration:none;}#yiv6715055271 dd.yiv6715055271last p a {font-family:Verdana;font-weight:700;}#yiv6715055271 dd.yiv6715055271last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv6715055271 dd.yiv6715055271last p span.yiv6715055271yshortcuts {margin-right:0;}#yiv6715055271 div.yiv6715055271attach-table div div a {text-decoration:none;}#yiv6715055271 div.yiv6715055271attach-table {width:400px;}#yiv6715055271 div.yiv6715055271file-title a, #yiv6715055271 div.yiv6715055271file-title a:active, #yiv6715055271 div.yiv6715055271file-title a:hover, #yiv6715055271 div.yiv6715055271file-title a:visited {text-decoration:none;}#yiv6715055271 div.yiv6715055271photo-title a, #yiv6715055271 div.yiv6715055271photo-title a:active, #yiv6715055271 div.yiv6715055271photo-title a:hover, #yiv6715055271 div.yiv6715055271photo-title a:visited {text-decoration:none;}#yiv6715055271 div#yiv6715055271ygrp-mlmsg #yiv6715055271ygrp-msg p a span.yiv6715055271yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv6715055271 .yiv6715055271green {color:#628c2a;}#yiv6715055271 .yiv6715055271MsoNormal {margin:0 0 0 0;}#yiv6715055271 o {font-size:0;}#yiv6715055271 #yiv6715055271photos div {float:left;width:72px;}#yiv6715055271 #yiv6715055271photos div div {border:1px solid #666666;min-height:62px;overflow:hidden;width:62px;}#yiv6715055271 #yiv6715055271photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv6715055271 #yiv6715055271reco-category {font-size:77%;}#yiv6715055271 #yiv6715055271reco-desc {font-size:77%;}#yiv6715055271 .yiv6715055271replbq {margin:4px;}#yiv6715055271 #yiv6715055271ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv6715055271 #yiv6715055271ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv6715055271 #yiv6715055271ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv6715055271 #yiv6715055271ygrp-mlmsg select, #yiv6715055271 input, #yiv6715055271 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv6715055271 #yiv6715055271ygrp-mlmsg pre, #yiv6715055271 code {font:115% monospace;}#yiv6715055271 #yiv6715055271ygrp-mlmsg * {line-height:1.22em;}#yiv6715055271 #yiv6715055271ygrp-mlmsg #yiv6715055271logo {padding-bottom:10px;}#yiv6715055271 #yiv6715055271ygrp-msg p a {font-family:Verdana;}#yiv6715055271 #yiv6715055271ygrp-msg p#yiv6715055271attach-count span {color:#1E66AE;font-weight:700;}#yiv6715055271 #yiv6715055271ygrp-reco #yiv6715055271reco-head {color:#ff7900;font-weight:700;}#yiv6715055271 #yiv6715055271ygrp-reco {margin-bottom:20px;padding:0px;}#yiv6715055271 #yiv6715055271ygrp-sponsor #yiv6715055271ov li a {font-size:130%;text-decoration:none;}#yiv6715055271 #yiv6715055271ygrp-sponsor #yiv6715055271ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv6715055271 #yiv6715055271ygrp-sponsor #yiv6715055271ov ul {margin:0;padding:0 0 0 8px;}#yiv6715055271 #yiv6715055271ygrp-text {font-family:Georgia;}#yiv6715055271 #yiv6715055271ygrp-text p {margin:0 0 1em 0;}#yiv6715055271 #yiv6715055271ygrp-text tt {font-size:120%;}#yiv6715055271 #yiv6715055271ygrp-vital ul li:last-child {border-right:none !important;}#yiv6715055271