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 |
|
OldMySQLUser
Constraint Violating Yak Guru
301 Posts |
Posted - 2009-07-23 : 06:31:49
|
| I am usingUSE debtGO/* Change Categories */declare @cnt intdelete FROM DebtorCategories AS dcJOIN Debtor AS dtrON dtr.DebtorID = dc.DebtorIDJOIN TraceOutputTemp AS tmpON dt.Code = tmp.Refwhere tmp.Ref = dt.code ANDtmp.DebtorNo = dtr.DebtorNo AND dc.DebtorCategoryCode in ('0002' ,'0003' ,'0004' , '0005')GObut SQL complains with 'incorrect syntax near the keyword AS'. I cannot see why this should be. Any ideas appreciated. |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-07-23 : 06:33:02
|
| delete dcFROM DebtorCategories AS dcJOIN Debtor AS dtrON dtr.DebtorID = dc.DebtorIDJOIN TraceOutputTemp AS tmpON dt.Code = tmp.Refwhere tmp.Ref = dt.code ANDtmp.DebtorNo = dtr.DebtorNo AND dc.DebtorCategoryCode in ('0002' ,'0003' ,'0004' , '0005') |
 |
|
|
OldMySQLUser
Constraint Violating Yak Guru
301 Posts |
Posted - 2009-07-23 : 06:42:38
|
| Thanks for the reply.But, what exactly was the error I made please. (My brain really is not functioning today at all) |
 |
|
|
asafg
Starting Member
39 Posts |
Posted - 2009-07-23 : 07:44:24
|
| you told the sqlwhich tables are relevant in the from partyou said what qualifies records that should be deleted in the where partso you have a list of rows that qualify for deletionbut from where?Delete XFROMX is the table from which rows will be removed... follow OldMySQLUser code... it's nice and simple |
 |
|
|
|
|
|