Breaking News
Loading...
25/03/2014

Các cách thay thế Cursor trong SQL Server để tăng performance

Các cách để thay thế cursor

1. Dùng Cross apply

update test1
set test1.a = c.q
from test1 b cross apply dbo.fnsomelogic(b.x,b.y,b.z) c
--Execution Time: (9132 row(s) affected) in less than a second.   

http://www.codeproject.com/Tips/654894/How-to-Use-Cross-Apply-Instead-of-Cursors-in-SQL-S

2. Sử dụng table variable thay cho cursor 
http://www.codeproject.com/Tips/671658/Using-Table-variable-instead-of-Cursor-Variable

0 comments:

Post a Comment

 
Toggle Footer