1.表Table_A
A_ID | A_CODE |
1 | FILE |
2 | DOCUMENT |
2.表Table_B
B_ID | B_TYPE |
1 | FILEINFO |
2 | DOCUMENTINFO |
3.更新Table_A表中A_CODE和表Table_B中B_TYPE字段相似的,Table_A的A_CODE值为Table_B中B_TYPE
UPDATE Table_A SET A_CODE=tab2.B_TYPE FROM Table_A as tab1 JOIN Table_B as tab2 ON tab2.B_TYPE like '%'+tab1.A_CODE+'%'
备注:CONCAT拼接是mysql的用法,SQL Server 直接使用+进行拼接