469,081 Members | 1,882 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,081 developers. It's quick & easy.

Trigger code

Am using SQL Server 2000 on WINXP Pro. Have a requirement to change some
Oracle triggers to SQL 2000. I have modied this one Insert Trigger, but get
an error when I attempt to compile:
CREATE TRIGGER trg_ins_attend_audit_log
ON ATTEND
AFTER INSERT
-- Insert Trigger for SQL Server
AS
DECLARE

BEGIN

Insert ATTEND_AUDIT_LOG

Select licnum,lic_suffix,als_hsp_id,last_name,
first_name,mid_name,birth_date,sex,
serv1,serv2,serv3,paid_vol,amb_res,
street1,street2,town,state,zipcode,
phone,lic_year,print_lic,lic_exp,send_hx,
user_id,getdate(),"I",modified
from inserted

END

ERROR:Incorrect syntax near "AS."
Can anyone point out the error of my ways here??
Jul 20 '05 #1
2 1485
Hi

Books online will give you the syntax for CREATE TRIGGER

Such as:
CREATE TRIGGER trg_ins_attend_audit_log
ON ATTEND
FOR INSERT
AS
BEGIN
Insert ATTEND_AUDIT_LOG
Select licnum,lic_suffix,als_hsp_id,last_name,
first_name,mid_name,birth_date,sex,
serv1,serv2,serv3,paid_vol,amb_res,
street1,street2,town,state,zipcode,
phone,lic_year,print_lic,lic_exp,send_hx,
user_id,getdate(),"I",modified
from inserted
END

John

"William F. O'Neill" <wf******@bellsouth.net> wrote in message
news:M9******************@bignews1.bellsouth.net.. .
Am using SQL Server 2000 on WINXP Pro. Have a requirement to change some
Oracle triggers to SQL 2000. I have modied this one Insert Trigger, but get an error when I attempt to compile:
CREATE TRIGGER trg_ins_attend_audit_log
ON ATTEND
AFTER INSERT
-- Insert Trigger for SQL Server
AS
DECLARE

BEGIN

Insert ATTEND_AUDIT_LOG

Select licnum,lic_suffix,als_hsp_id,last_name,
first_name,mid_name,birth_date,sex,
serv1,serv2,serv3,paid_vol,amb_res,
street1,street2,town,state,zipcode,
phone,lic_year,print_lic,lic_exp,send_hx,
user_id,getdate(),"I",modified
from inserted

END

ERROR:Incorrect syntax near "AS."
Can anyone point out the error of my ways here??

Jul 20 '05 #2
Hi John:
Thanks for your assistance. I did refer to BOL, but I guess I missed the
'FOR', rather than 'AFTER.'
Bill...

"John Bell" <jb************@hotmail.com> wrote in message
news:41**********************@news.easynet.co.uk.. .
Hi

Books online will give you the syntax for CREATE TRIGGER

Such as:
CREATE TRIGGER trg_ins_attend_audit_log
ON ATTEND
FOR INSERT
AS
BEGIN
Insert ATTEND_AUDIT_LOG
Select licnum,lic_suffix,als_hsp_id,last_name,
first_name,mid_name,birth_date,sex,
serv1,serv2,serv3,paid_vol,amb_res,
street1,street2,town,state,zipcode,
phone,lic_year,print_lic,lic_exp,send_hx,
user_id,getdate(),"I",modified
from inserted
END

John

"William F. O'Neill" <wf******@bellsouth.net> wrote in message
news:M9******************@bignews1.bellsouth.net.. .
Am using SQL Server 2000 on WINXP Pro. Have a requirement to change some
Oracle triggers to SQL 2000. I have modied this one Insert Trigger, but

get
an error when I attempt to compile:
CREATE TRIGGER trg_ins_attend_audit_log
ON ATTEND
AFTER INSERT
-- Insert Trigger for SQL Server
AS
DECLARE

BEGIN

Insert ATTEND_AUDIT_LOG

Select licnum,lic_suffix,als_hsp_id,last_name,
first_name,mid_name,birth_date,sex,
serv1,serv2,serv3,paid_vol,amb_res,
street1,street2,town,state,zipcode,
phone,lic_year,print_lic,lic_exp,send_hx,
user_id,getdate(),"I",modified
from inserted

END

ERROR:Incorrect syntax near "AS."
Can anyone point out the error of my ways here??


Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Scott CM | last post: by
9 posts views Thread by Martin | last post: by
3 posts views Thread by takilroy | last post: by
2 posts views Thread by Jules Alberts | last post: by
reply views Thread by JohnO | last post: by
3 posts views Thread by ChrisN | last post: by
2 posts views Thread by dean.cochrane | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.