Hail,
I just started to play with triggers in my SQL database. I got the basics of it down I think but this is what I need to do.
One of my fields is a date+time, with datetime as datatype. I want to trigger each time a record has a datetime for today (so date is today, time is whenever). How would I write the WHERE statement?
I tried:
CREATE TRIGGER GetASAP ON dbo.reservation_tbl
FOR INSERT,UPDATE
AS
insert into ASAP
select cnfrmtn_nmbr, gmt_strt, cnfrnc_nm, lcl_phn, lns_usd, cnfrnc_typ, cncl, tm_stmp from inserted
WHERE cnfrnc_typ like "OPDO" or cnfrnc_typ like "OPMM" or cnfrnc_nm like "*$*" and gmt_strt like "" & date() & "*"
I also tried date without () with no success. Is there a way I can use the date function?
Phailak
I just started to play with triggers in my SQL database. I got the basics of it down I think but this is what I need to do.
One of my fields is a date+time, with datetime as datatype. I want to trigger each time a record has a datetime for today (so date is today, time is whenever). How would I write the WHERE statement?
I tried:
CREATE TRIGGER GetASAP ON dbo.reservation_tbl
FOR INSERT,UPDATE
AS
insert into ASAP
select cnfrmtn_nmbr, gmt_strt, cnfrnc_nm, lcl_phn, lns_usd, cnfrnc_typ, cncl, tm_stmp from inserted
WHERE cnfrnc_typ like "OPDO" or cnfrnc_typ like "OPMM" or cnfrnc_nm like "*$*" and gmt_strt like "" & date() & "*"
I also tried date without () with no success. Is there a way I can use the date function?
Phailak