No, actually my error message was something like "LIMIT: Unknown keyword", I couldn't find the output file, so couldn't copy the exact error here. But the error (and SQL Server documentation) says that SQL Server doesn't support LIMIT keyword at all.
In my temp solution, I just removed it. It now works, but I don't know what's going to happen, when number of records are too much...
I guess your solution is for posgres. But thanks for the reply
[originally posted on jforum.net by cagin]