Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compilation error in a trigger

Status
Not open for further replies.

sujosh

Programmer
Joined
Nov 29, 2001
Messages
93
Location
US
When I try to run this I get an error saying Incorrect syntax near '@as_xml'and it fails on this line

"Select @as_oper = 'INSERT' " specifically. The snippent of the trigger is below. Any help is appreciated

Thanks
JD




CREATE TRIGGER asst_trig ON fa
FOR INSERT
AS

Declare @as_xml varchar(255),@as_code varchar(20),@as_tag varchar(20),@as_loc varchar(20),@as_tab_name varchar(50),@as_oper varchar(20)

Select @as_code = Inserted.asset_code,
@as_tag = Inserted.asset_tag,
@as_loc = Inserted.asset_location from Inserted

Select @as_tab_name = 'FA'
Select @as_oper = 'INSERT'
Select @as_xml = '<asset_tag>'+@as_tag+'</asset_tag>'
Select @as_xml = @as_xml + '<asset_code>'+@as_code+'</asset_code>'
Select @as_xml = @as_xml + '<asset_location>'+@as_loc+'</asset_location>'

/* Generate a row in trans */
exec sp_insert_pv_trans (@as_xml,@as_tab_name,@as_oper)
 
May be check the value of your as_tag ,as-code and as_loc before you use the select. I feel some reserved quotes might be set in these variables.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top