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 2005 Forums
 Transact-SQL (2005)
 Problems with a Simple Delete Query

Author  Topic 

qman
Constraint Violating Yak Guru

442 Posts

Posted - 2009-09-09 : 08:55:30
Does anyone see anything wrone with my delete query?

I get the following error when running the below query:

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'scc'.

delete from dbo.Study_Contribution_Contacts scc
inner join dbo.Study_Contributions sc on sc.study_contributions_id = scc.contribution_id
where sc.study_id = 0x0000000000000122

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-09-09 : 08:58:35
delete scc from dbo.Study_Contribution_Contacts scc
inner join dbo.Study_Contributions sc on sc.study_contributions_id = scc.contribution_id
where sc.study_id = 0x0000000000000122
Go to Top of Page

qman
Constraint Violating Yak Guru

442 Posts

Posted - 2009-09-09 : 09:46:13
Thanks, told you it was simple!
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-09-10 : 00:20:22
Hi, also use this

delete from Study_Contribution_Contacts
where study_contributions_id in ( select study_contributions_id from Study_Contributions
where study_id = 0x0000000000000122 )
Go to Top of Page

qman
Constraint Violating Yak Guru

442 Posts

Posted - 2009-09-10 : 07:40:07
Thanks for the other approach.
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-09-10 : 07:56:24
quote:
Originally posted by qman

Thanks for the other approach.



Welcome
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2009-09-10 : 10:03:02
This may apply here: http://weblogs.sqlteam.com/mladenp/archive/2007/05/18/60210.aspx

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -