Skip to content

Commit

Permalink
Fix zio#2709: SQL Server top statement doesn't use parenthesis.
Browse files Browse the repository at this point in the history
  • Loading branch information
lprieur-drevon-ncl committed Mar 1, 2023
1 parent c33ac29 commit ce5a06a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ trait SQLServerDialect

override protected def limitOffsetToken(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 ce5a06a

Please sign in to comment.