diff --git a/src/visitor.ts b/src/visitor.ts index 669abaa..06162a5 100644 --- a/src/visitor.ts +++ b/src/visitor.ts @@ -376,12 +376,12 @@ export class Visitor{ this.where += ")"; break; case "tolower": - this.where += "LCASE("; + this.where += this.type === SQLLang.MsSql ? "LOWER(" : "LCASE("; this.Visit(params[0], context); this.where += ")"; break; case "toupper": - this.where += "UCASE("; + this.where += this.type === SQLLang.MsSql ? "UPPER(" :"UCASE("; this.Visit(params[0], context); this.where += ")"; break; diff --git a/test/mssql.spec.js b/test/mssql.spec.js index 3077afd..661ab16 100644 --- a/test/mssql.spec.js +++ b/test/mssql.spec.js @@ -109,11 +109,11 @@ describe("SQL WHERE useParameters (MS-SQL)", () => { }) it("expression 5.1.1.4.7: tolower(A) eq 'abc'", () => { - expect(f.where).to.equal("LCASE([A]) = @p0") + expect(f.where).to.equal("LOWER([A]) = @p0") }) it("expression 5.1.1.4.8: toupper(A) eq 'ABC'", () => { - expect(f.where).to.equal("UCASE([A]) = @p0") + expect(f.where).to.equal("UPPER([A]) = @p0") }) it("expression 5.1.1.4.9: trim(A) eq 'abc'", () => {