Project

General

Profile

Bug #730

Khi đồng bộ, cột BRANCH_NAME bị NULL (fix xong store, đang chạy fix dữ liệu)

Added by Luc Tran Van over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Start date:
12/15/2020
Due date:
% Done:

0%

Estimated time:

Description

--Khai báo biến @id, @title để lưu nội dung đọc
DECLARE @id VARCHAR
DECLARE @title nvarchar(200)

DECLARE cursorProduct CURSOR FOR -- khai báo con trỏ cursorProduct
SELECT TLID,TLSUBBRID FROM TL_USER -- dữ liệu trỏ tới

OPEN cursorProduct -- Mở con trỏ

FETCH NEXT FROM cursorProduct -- Đọc dòng đầu tiên
INTO @id, @title

WHILE @@FETCH_STATUS = 0 --vòng lặp WHILE khi đọc Cursor thành công
BEGIN
--In kết quả hoặc thực hiện bất kỳ truy vấn
--nào dựa trên kết quả đọc được
UPDATE TL_USER SET BRANCH_NAME =(SELECT TOP 1 BRANCH_NAME FROM CM_BRANCH WHERE BRANCH_ID =@title) WHERE TLID =@id

FETCH NEXT FROM cursorProduct -- Đọc dòng tiếp
INTO @id, @title
END

CLOSE cursorProduct -- Đóng Cursor
DEALLOCATE cursorProduct -- Giải phóng tài nguyên

History

#1 Updated by Luc Tran Van over 4 years ago

  • Status changed from New to Closed

Also available in: Atom PDF