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 |
|
dwalker79
Yak Posting Veteran
54 Posts |
Posted - 2008-12-11 : 08:18:17
|
| Can someone pleaes help me. I know why this statement is returning the error: "Subquery returned more than 1 value". I just need to know how to rewrite it so it works correctly.Can anyone please help me with this?Here is the statement:update ##EmployeeAuctionSite_repl set ##EmployeeAuctionSite_repl.EmployeeID = (select Employee.EmployeeID from Employee where Employee.LegacyPersID = ##EmployeeAuctionSite_repl.LegacyPersID) Thanks!! |
|
|
soorajtnpki
Posting Yak Master
231 Posts |
Posted - 2008-12-11 : 08:36:46
|
| hi just try this - use IN update table set col='newvalue' where id IN (select Employee.EmployeeID from Employee where Employee.LegacyPersID = ##EmployeeAuctionSite_repl.LegacyPersID) OK TANX |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2008-12-11 : 08:37:03
|
| Fix your data. You have more than one employee in your Employee table that has the same LegacyPersID.[Signature]For fast help, follow this link:http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxLearn SQL or How to sell Used CarsFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-11 : 08:54:33
|
Also use ANSI style if possible.UPDATE xSET x.EmployeeID = e.EmployeeIDFROM ##EmployeeAuctionSite_repl AS xLEFT JOIN Employee AS e ON e.LegacyPersID = x.LegacyPersID E 12°55'05.63"N 56°04'39.26" |
 |
|
|
bjoerns
Posting Yak Master
154 Posts |
Posted - 2008-12-11 : 09:01:08
|
Hi Peso,UPDATE FROM is hardly ANSI-Standard |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-11 : 09:11:00
|
No, it is not standard, but it follows ANSI join style. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|