<p>I have a column in my database (a flag) with type varchar(1) that is populated either Y or NULL (this is how it is, not in my control).</p>

<p>In SQL Server, doing an ascending order by query, NULL is ordered at the top. Should this behaviour be consistent for Oracle and DB2? </p>

<p>If, instead I have a COALESCE on the column to ensure it is not null in the query, am I likely to hit any performance issues (due to table scans and the like)?</p>

<p><strong>EDIT</strong></p>

<p>The query needs to be consistent over all 3 databases, otherwise I will have to handle it in code, hence my thinking of using the COALESCE function</p>

<p><strong>EDIT</strong></p>

<p>I chose Pax as the answer, as it dealt with both parts of the question and gave a helpful workaround, however, thanks to me.yahoo.com/a/P4tXrx for the link to <a href="http://en.wikipedia.org/wiki/Order_by_(SQL)" rel="nofollow noreferrer">here</a></p>

In oracle you can do this:
```
```
ORDER BY value NULLS FIRST
```
```
or
```
```
ORDER BY value NULLS LAST
```
```
Try it in SQL Server