diff --git a/uppsrc/Sql/SqlStatement.cpp b/uppsrc/Sql/SqlStatement.cpp index ad74598c6..a087e6bda 100644 --- a/uppsrc/Sql/SqlStatement.cpp +++ b/uppsrc/Sql/SqlStatement.cpp @@ -115,7 +115,10 @@ SqlSelect& SqlSelect::NoWait() { } SqlSelect& SqlSelect::Limit(int limit) { - text << " limit " << limit; + ASSERT(text.StartsWith("select ")); + String s = AsString(limit); + text.Insert(6, SqlCase(MSSQL, " top " + s)()); + text << SqlCase(MSSQL, "")(" limit " + s); return *this; }