SQL Server Equivalent of Bulk Collect in Oracle

I want to replicate the following code in SQL Server. I've had a look around and it seems like the only option is to just use a straight cursor, but is there a better way:


    CURSOR cursor1 IS
    SELECT *
    FROM table1;

    TYPE cursor_aat IS TABLE OF cursor1%ROWTYPE;        

    l_cursor cursor_aat;
    OPEN cursor1;


        FETCH cursor1
        BULK COLLECT INTO l_cursor LIMIT 200;

        FOR INDX IN 1 .. l_cursor.COUNT LOOP
            IF (CheckSomeData() = 0) THEN           
                INSERT INTO new_table
                (col1, col2)
                (l_cursor(INDX).col1, l_cursor(INDX).col2);

                INSERT INTO new_table2

            end if

        END LOOP;

        EXIT WHEN l_cursor.COUNT < 200;


You could use a temporary table and a cursor if you want to do 200 rows at once.

Need Your Help

CRM 2011 Activities

reporting-services dynamics-crm-2011 crm fetchxml

I am building a ssrs report for crm 2011 using fetchxml.

jQuery min-height of section equal to windows height

javascript jquery html css

I'm trying to set the min-height of each of these sections to the the height of the window. This is the current code...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.