Msg 512, Level 16, State 1, Line 1 help needed please!

46 views
Skip to first unread message

Totti

unread,
Mar 17, 2011, 11:00:15 AM3/17/11
to SQL Server
Hi everyone,
i have been given a DB with about 7 millions records, its called
TRIAL, i am trying to update some fields inside it that are duplicated
like field B2B ='03-37329' and B2B ='03-37406' where B2B is not a
unique ID so there are many rows with B2B ...329 and ...406 and so on.
now my job is that when i find some common criteria, i woud set B2B,
NAME_A and DESC_A to same value in all ...329 and ...406 so they
become alike, i might have 3 ...329(same record repeated) and 7 ...
406(same record repeated) and i want to make them 10 records repeated
but under 1 B2B either 329 or 406 it makes no difference.
to my knowledge, i used this:

UPDATE KAP3.dbo.TRIAL
SET
EDITTED = ' ',
B2B ='03-37329',
NAME_A =(SELECT NAME_A FROM KAP3.dbo.TRIAL WHERE B2B = '03-37329'),
DESC_A =(SELECT DESC_A FROM KAP3.dbo.TRIAL WHERE B2B = '03-37329')
WHERE
B2B in ('03-37329','03-37406');

but to due to multi records of each i am having this error message

Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the
subquery follows =, !=, <, <= , >, >= or when the subquery is used as
an expression.
The statement has been terminated.

and i dont really know how to overcome this problem.
would you please provide your appreciated help?!
Reply all
Reply to author
Forward
0 new messages