Example:
Update a set a.name=b.name1 from a, where a.id=b.id
Example extension: How do I change strings to scientific notation when we update them?
A: Convert with cast, or double cast
Update Loaneeexpand set Loaneeexpand.phone=cast (CAST (TT. PHONE as Decimal (18,0) as nvarchar ()) from Loaneeexpand, TT where Loaneeexpand. id=tt.id
Again, the example extends the problem: update
String or binary data would be truncated.
The statement has been terminated.
string or binary data will be truncated.
The statement has been terminated. What to do?
It is clear that the field of the table you are updating is not long enough, but query all the true lengths of Table B Len (b.name) <20. Matches the length of the field in Table A, why is this?
A: When updating Table A, and is not calculated according to the actual length of table B, but according to the definition of Table B field length, all the table a needs to modify the length of the field, according to table B field length set.
SQL Updates an example of another table based on one table and the problems that may be encountered