> For the complete documentation index, see [llms.txt](https://kythuat.dtechvn.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kythuat.dtechvn.com/danh-muc/mo-rong-ky-tu-cho-cot-ma.md).

# MỞ RỘNG KÝ TỰ CHO CỘT MÃ

```
// Tăng ký 001 => 0001 do tràn ký tự
// sử dụng hàm STUFF(string gốc, vị trí chèn, số lượng ký tự xoá, ký tự mới cần chèn)
// số lượng ký tự xoá: nếu không xoá thì để =0
select ma,stuff(ma,7,0,'0'),vattu from vattu where ma like 'lodot.%'
update vattu set ma = stuff(ma,7,0,'0'),modidate=getdate() where ma like 'lodot.%'
```
