?
Solved

incorrect syntax near the keyword 'tran'

Posted on 2009-04-18
3
Medium Priority
?
1,649 Views
Last Modified: 2012-06-27
To Whom it May Concern:

I am a student near the final exams. I am trying to write code to insert a reservation for two tables in a restaurant. I can't solve this error message.

The database Resaurant_06 is a fictitious database.  See the attatchment please.

Thanks, Frances123

incorrect-syntax-near-the-keywor.txt
0
Comment
Question by:frances123
2 Comments
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 24177329
Its probably this bit:
rollback tran spCreateReservation
try using this instead:
rollback tran
It should tell you what line the error occurs - what line is it?
Also you are usually better off using SCOPE_IDENTITY() rather than @@IDENTITY
 
0
 
LVL 1

Accepted Solution

by:
hendrik_johns earned 80 total points
ID: 24180541
Hi Frances123,

the problem is the 2 places where you have this line "rollback tran spCreateReservation"

The line "rollback tran spCreateReservation" tells that a transaction named spCreateReservation should be rollback but you don't have a transaction named spCreateReservation (That is the name of the sproc)

In you case just change the 2 lines to rollback tran or give the transaction a name

Cheers,

Hendrik
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question