Is there a faster or more efficient way to select the next record than this?
SELECT TOP 1 *
FROM MyTable
WHERE ID > @LastIDRead
ORDER BY ID
Note: I need all the columns
如果您在ID上拥有CLUSTERED INDEX,这是最快的方法。
the "next record" is irrelevant here, what you want is to get a record based on its ID. If the Id is indexed, that would be the best option.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.