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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 deleting from joined tables

Author  Topic 

sagey
Starting Member

4 Posts

Posted - 2002-10-04 : 05:21:58
i want to delete all row information from
brandedrenewals table and delete the related information from
brandedrenewalsummary. i'm using this query.

delete
from brandedrenewals
inner join brandedrenewalsummary on brandedrenewals.smanucode
= brandedrenewalsummary.smanucode
where status <> 0

but i get this error message

Server: Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'inner'.

as far as i can see there is nothing wrong with my syntax
so i'm assuming i'm using the wrong sort of join, i dont know.

if anyone can help that would be great


nr
SQLTeam MVY

12543 Posts

Posted - 2002-10-04 : 05:29:01
delete brandedrenewals
from brandedrenewalsummary
where brandedrenewals.smanucode
= brandedrenewalsummary.smanucode
and status <> 0

or

delete brandedrenewals
from brandedrenewals
inner join brandedrenewalsummary on brandedrenewals.smanucode
= brandedrenewalsummary.smanucode
where status <> 0


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

sagey
Starting Member

4 Posts

Posted - 2002-10-04 : 06:56:13
cheers for that it was a big help

Go to Top of Page
   

- Advertisement -