>Which is:
>DECLARE CURSOR
>DECLARE FETCH INTO variables
>
>OPEN CURSOR
>FETCH CURSOR ÌNTO variables
>WHILE @@FETCH_STATUS
>BEGIN
> IF variable1 ....
> ...
> ...
> FETCH
>END
>
>CLOSE CURSOR
>DEALLOCATE CURSOR
This is how it's done. The question that you should be asking yourself is: "Self - do I really need to use a cursor??" <bg>
-Mike
>In Oracle I can reference a cursor rowset using the following syntax:
>
>DECLARE C_CUSOR AS
>SELECT NAME,SALARY,...
> FROM A_TABLE
>
>FOR M_CURSOR IN C_CURSOR
>LOOP
> IF M_CURSOR.SALARY > 50000 THEN
> ....
> ....
> END IF
>END LOOP
>
>
>
>NOTES:
>1- I do not have to declare M_CURSOR it's declare implicitely with the FOR...
>2- I do not need to OPEN, FETCH, CLOSE AND DEALLOCATE the cursor, done automatically.
>3- There is no need to declare a variable to store the fetched row..
>
>
>I'm far from 'bitching' against SQL Server, there is a little voice in me that says that there should be a more clever way of doing what I'm doing in SQL Server right now...
>
>Which is:
>DECLARE CURSOR
>DECLARE FETCH INTO variables
>
>OPEN CURSOR
>FETCH CURSOR ÌNTO variables
>WHILE @@FETCH_STATUS
>BEGIN
> IF variable1 ....
> ...
> ...
> FETCH
>END
>
>CLOSE CURSOR
>DEALLOCATE CURSOR
>
>Thanks!