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 |
|
johnjh
Starting Member
4 Posts |
Posted - 2007-09-21 : 14:18:43
|
| Hi,I try to run the script below to update data with trailing CR on QL 2005 and got this error. I remember I used the same script on SQL 2000 a while back and worked fine. What can I do to fix it?"Only one expression can be specified in the select list when the subquery is not introduced with EXISTS"Thanks,John |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-09-21 : 14:21:15
|
| Can you post the script?Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
johnjh
Starting Member
4 Posts |
Posted - 2007-09-21 : 15:56:29
|
| Oops, sorry, here is the script.DECLARE @CR varchar (100)SET @CR= '%'+char(13)UPDATE SyUserValues SET FieldValue=REPLACE(FieldValue,CHAR(13),'') WHERE FieldValue IN (SELECT * FROM SyUserValues WHERE FieldValue LIKE @CR) |
 |
|
|
johnjh
Starting Member
4 Posts |
Posted - 2007-09-21 : 15:59:48
|
| This is the correct one.DECLARE @CR varchar (100)SET @CR= '%'+char(13)UPDATE SyUserValues SET FieldValue=REPLACE(FieldValue,CHAR(13),'') WHERE FieldValue IN (SELECT * FROM SyUserValues WHERE FieldValue LIKE @CR AND SyUserDictID in (1, 2, 3)) |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-09-21 : 16:20:46
|
| The problem is here: WHERE FieldValue IN (SELECT *You need to specify a column instead of *. Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
johnjh
Starting Member
4 Posts |
Posted - 2007-09-21 : 16:26:17
|
| Awesome, it works now! Thank you so much! |
 |
|
|
|
|
|