When using sql queries with "order by" immediately followed by a line break, the mssql2005 dialect breaks the SetFirstResult/SetMaxResults query. From MsSql2005Dialect.cs (line 53, NHibernate 2.0.1):
Code:
int orderIndex = querySqlString.LastIndexOfCaseInsensitive(" order by ");
This part fails if "order by" is followed by '\n' or '\r', and I assume that it fails for any whitespace character other than space.
MS SQL 2008 accepts '\n' as valid whitespace characters at this point. However, I'm not sure whether it is legal to pass these characters to NHibernate, so it might be a bug on my side.