SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


t-sql 2008 r2 error message


t-sql 2008 r2 error message

Author
Message
wendy elizabeth
wendy elizabeth
Hall of Fame
Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)

Group: General Forum Members
Points: 3616 Visits: 824
This is the first time I am writing a trigger. I am getting the following error message on a sql server 2008 r2 database.

"Msg 102, Level 15, State 1, Procedure eRPT_Transaction_Audit, Line 15 Incorrect syntax near 'TRY'. I do not know what is wrong can you tell me what is wrong with the following sql:


USE DEV
GO
CREATE TRIGGER [dbo].[eRPT_Transaction_Audit] ON [dbo].[eRPT_Transaction_Tracking]
AFTER INSERT
AS

BEGIN
SET NOCOUNT ON;

BEGIN TRY
INSERT INTO [dbo].[eRPT_Transaction_Audit] (Package_name, Received_Date, Download_Date,
Acknowledge_Date, Response_Docs_Date, Error_Report_Date,
FDR_Report_Date, Close_Date, File_Location,Response_Code)
SELECT Package_name, Received_Date, Download_Date,
Acknowledge_Date, Response_Docs_Date, Error_Report_Date,
FDR_Report_Date, Close_Date, File_Location,Response_Code FROM INSERTED
END TRY

END
GO



also note in the trigger, I am not listing the identity key for the table
ALZDBA
ALZDBA
One Orange Chip
One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)

Group: General Forum Members
Points: 29241 Visits: 8986
there is no catch block in your trigger. Is that how you intend it ? If so, don't use the try.

Johan


Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere w00t

- How to post Performance Problems
- How to post data/code to get the best help


- How to prevent a sore throat after hours of presenting ppt ?


press F1 for solution, press shift+F1 for urgent solution :-D


Need a bit of Powershell? How about this

Who am I ? Sometimes this is me Alien but most of the time this is me Hehe
Sean Lange
Sean Lange
SSC Guru
SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)

Group: General Forum Members
Points: 61409 Visits: 17954
Please don't cross post. direct all replies here. http://www.sqlservercentral.com/Forums/Topic1412099-392-1.aspx

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search