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
 SQL Server Development (2000)
 Update query problem

Author  Topic 

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2007-09-14 : 06:20:21
Hello.
Im trying to change the perioddays to 60
for 2 branchcodes (16,21)
The problem that i get is

"Only one expression can be specified in the select list when the subquery is not introduced with EXISTS."
please help.

update dbo.creditperiodlines
set dbo.creditperiodlines.PERIODDAYS = 60
where creditperiodlines.Branchcodeid in (SELECT dbo.CREDITPERIOD.*, dbo.CREDITPERIODLINES.ID AS Expr1, dbo.CREDITPERIODLINES.BRANCHCODEID,
dbo.CREDITPERIODLINES.PERIODDAYS
FROM dbo.CREDITPERIOD INNER JOIN
dbo.CREDITPERIODLINES ON dbo.CREDITPERIOD.ID = dbo.CREDITPERIODLINES.CREDITPERIODID
WHERE (dbo.CREDITPERIODLINES.BRANCHCODEID IN (16, 21)))

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2007-09-14 : 06:47:54
Never mind i got it.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-09-14 : 06:48:57
"where creditperiodlines.Branchcodeid in (SELECT MyColumn"

You need to specify a SINGLE column in place of MyColumn, which should be the column that contains values you want to match against creditperiodlines.Branchcodeid.

You have specified multiple columns, so SQL Server won't know which one to match against!

Kristen
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-09-14 : 07:21:49
Exact same discussion here
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=89354&SearchTerms=why,this,work



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2007-09-14 : 07:57:44
Yes i know. That was my problem.
Thanks for taking the time to have a look.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-09-14 : 08:01:59
You are underwms too?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -