1 sql sql-server-2005 sql-update
我有一个有4列的表.
Id Description Barcode Type
1 A01 L001 Loc
2 A02 L002 Loc
3 B01 L003 Loc
4 Root L004 Parent
5 Emplacement L005 Parent
6 C01 L006 Loc
7 C02 L007 Loc
Run Code Online (Sandbox Code Playgroud)
我想使用"描述"列中的值("类型"列包含"Loc")对"条形码"列进行更新.
我试过这样的事情:
UPDATE MyTable
SET Barcode=Description
WHERE Type='Loc'
Run Code Online (Sandbox Code Playgroud)
好像我弄错了.
你需要引用,Loc因为它是一个字符串
UPDATE MyTable
SET Barcode=Description
WHERE Type='Loc'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
67 次 |
| 最近记录: |