0

给定一个简单的游标语句:

DECLARE vend_cursor CURSOR
    FOR SELECT * FROM Purchasing.Vendor
    --say my Purchasing.Vendor table did not have 'Company ABC', 'Company F'
    --can I explicitly add 'Company ABC' and 'Company F' to the Cursor without
    --adding them to the database?
OPEN vend_cursor
FETCH NEXT FROM vend_cursor;

是否可以为游标添加显式值以进行迭代?

实际上,我对此的应用回答了一个显而易见的问题:“你到底为什么不将它们添加到数据库中?” 只是看看语法会是什么样子直接添加到光标。

4

1 回答 1

5


    DECLARE vend_cursor CURSOR
        FOR SELECT * FROM Purchasing.Vendor
            UNION ALL select .... 'Company ABC'
            UNION ALL select .... 'Company F'
    --say my Purchasing.Vendor table did not have 'Company ABC', 'Company F'
    --can I explicitly add 'Company ABC' and 'Company F' to the Cursor without
    --adding them to the database?
   OPEN vend_cursor
   FETCH NEXT FROM vend_cursor;

于 2013-03-15T17:45:03.443 回答