Re: How to find first not null value in column



On 30 Jan 2006 19:57:03 -0800, Doug wrote:

>
>>> I've used cursors all the time without an order by function.my bad. <<
>
>
>>That will give you random results, based on the internal state of the
>database at the time of the query.
>
>Really???? Wow. Could you point me to the documentation that states
>that you will get a different set of data for your cursor if you don't
>use an order by statement?
>
>So which is it? Are we set based, or are we "set based, but sets are
>different depending on whether they are in order and in a cursor."

Hi Doug,

We are set based. And a set in a relational database is a collection of
rows with no implied order.

A cursor is not a set - it is an operation to turn a set into a series
of rows, with implied order. If you use ORDER BY in the DECLARE CURSOR
statement, the order of the rows in the cursor is defined. Without an
ORDER BY, the optimizer is free to choose an order in which the rows
will be fed to the cursor. And there is no guarantee that the same order
will be used the next time you execute the same statement.

--
Hugo Kornelis, SQL Server MVP
.



Relevant Pages

  • Re: psycopg, transactions and multiple cursors
    ... > first time a change is made to the database. ... My intention is actually to keep them in the same transaction. ... >> cursor fetches one record from the database at a time). ... > generated from the same connection, ...
    (comp.lang.python)
  • Re: Best Practices
    ... How you need to abstract database from ... maybe the same command object with a different command string)? ... Try not to design an application that uses one DataReader that is connected ... > define cursor 1 ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: [VisualAge] Long lists in Client/Server application
    ... I would be able to ask the cursor to ... if it IS a database ... should switch over now to see if I have the same issue on PostgreSQL. ... query, but I can't see any easy way to position the the cursor at the ...
    (comp.lang.smalltalk)
  • Re: Row Order
    ... morphed into a flat-file design into SQL Server. ... Server is a relational database that assumes set operations and doesn't let ... > somebody doesn't want to have to add an ORDER BY clause to the cursor ...
    (microsoft.public.sqlserver.programming)
  • Re: ADODC Requery and refresh dont work right
    ... Not each type of the cursor reflects changes in a database. ... roundtrips between the server and client. ... > details that are filtered through the data control. ...
    (microsoft.public.vb.database.ado)