Skip to content

Commit

Permalink
Fix #2709: SQL Server top statement doesn't use parenthesis. (#2710)
Browse files Browse the repository at this point in the history
Co-authored-by: Juliano Alves <von.juliano@gmail.com>
  • Loading branch information
loicprieur and juliano authored May 31, 2023
1 parent c393099 commit d304226
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/scala/io/getquill/SQLServerDialect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ trait SQLServerDialect
query: Statement
)(implicit astTokenizer: Tokenizer[Ast], strategy: NamingStrategy) =
Tokenizer[(Option[Ast], Option[Ast])] {
case (Some(limit), None) => stmt"TOP ${limit.token} $query"
case (Some(limit), None) => stmt"TOP (${limit.token}) $query"
case (Some(limit), Some(offset)) => stmt"$query OFFSET ${offset.token} ROWS FETCH FIRST ${limit.token} ROWS ONLY"
case (None, Some(offset)) => stmt"$query OFFSET ${offset.token} ROWS"
case other => super.limitOffsetToken(query).token(other)
Expand Down

0 comments on commit d304226

Please sign in to comment.