Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
anj755
Starting Member
8 Posts |
Posted - 2007-02-14 : 15:21:11
|
| if exists (select AiD from A where A.AiD = inserted.Aid)I am writing this statement on a trigger sp, where I have 'inserted' tableMay be it is very trivial but I can't seem to reason why this statement is returning a errorMsg 102, Level 15, State 1, Line 1Incorrect syntax near ')'. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-02-14 : 15:22:54
|
| if exists (select AiD from A inner join inserted on A.AiD = inserted.Aid)Tara Kizer |
 |
|
|
anj755
Starting Member
8 Posts |
Posted - 2007-02-14 : 15:39:29
|
| if exists (select AiD from A inner join inserted on A.AiD = inserted.AiD)still the same errorthis is all I have written in my codescreate trigger tableD_Insert on tableDinstead of insertasif exists (select AiD from A inner join inserted on A.AiD = inserted.AiD)Table A is a valid table in the database |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-02-14 : 16:13:21
|
| Well you need more code after the IF statement. You don't have a single line after the ). But if this is for a trigger (I didn't want to assume trigger in case inserted was an actual user table name), then you should not use IF to check for rows. You should use IF @@ROWCOUNT instead.Tara Kizer |
 |
|
|
anj755
Starting Member
8 Posts |
Posted - 2007-02-14 : 16:31:28
|
| You are right, the error I was getting had nothing to do with the if statement. I figured it out. I am sorry for wasting everyone's time, you know how it is, you are determined to finish few things before the end of day, and even the smallest error gets on your nerve. |
 |
|
|
|
|
|