Hi, I'm attempting to update multiple records using the query below:
--select n.id, email,member_type,first_name, last_name,left(first_name,1)+last_name,u.*--
update u set u.web_login=n.email, u.password=left(first_name,1)+last_name
from name n
join Name_security u on n.id=u.id
where n.email<>' ' and web_login<>' ' and u.password=' ' --and u.id='10015'--
When I run the query on a single record it updates fine. But when I run it on the group it returns the error below:
Msg 8152, Level 16, State 14, Line 2
String or binary data would be truncated.
The statement has been terminated.
either the email column or the password column is shorter that the data coming in. Either increase the length of the destination columns or truncate the data in the set expressions.
Thank Scott - that worked on the individual id record but I still get the same "truncation error" on the mass update.
I even did:
update u set u.web_login=n.email, u.password=Batboy1
from name n
join Name_security u on n.id=u.id
where n.email<>' ' and web_login<>' ' and u.password=' ' --and u.id='10045'
And it worked on the single id but crashed when I commented out the id.