Hi Venkat, 2013/7/16 Venkat Sadasivam <[email protected]>
> If I try the code below in SQL Server database > selectQuery.addSelect(Employee.EMPLOYEE.EMPLOYEE_DESC); > selectQuery.addFrom(Employee.EMPLOYEE); > > it generates SQL as below: > select dbo.Employee.Description from dbo.Employee order by 1 > I cannot reproduce this as described above. Did you omit adding a LIMIT clause? SQL Server 2012's OFFSET .. FETCH clause can only be added along with an ORDER BY clause: http://msdn.microsoft.com/en-us/library/gg699618.aspx That's why jOOQ adds ORDER BY 1 in the absence of an explicit ORDER BY clause. Obviously, this synthetic ordering is wrong when the first column from your projection is of a non-comparable data type. This is a bug, which I have registered as #2646: https://github.com/jOOQ/jOOQ/issues/2646 Do you have any idea how this is best solved? I could imagine using something like a hash value of the binary content. Unfortunately, CHECKSUM and BINARY_CHECKSUM don't support non-comparable data types either: - CHECKSUM: http://msdn.microsoft.com/en-us/library/ms189788.aspx - BINARY_CHECKSUM: http://msdn.microsoft.com/en-us/library/ms173784.aspx > > which throws exception as below. > Msg 306, Level 16, State 2, Line 1 > The text, ntext, and image data types cannot be compared or sorted, except > when using IS NULL or LIKE operator. > > Why does jOOQ adds order by 1? can that be removed? > > -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
