0

Hi I try to use SQLite Parameterized query but in the column name is a DOT (.)

INSERT INTO Data (`test.1`, `test.2`, `test.3`) VALUES (@test.1, @test.3,@test.3)

Returns

"SQL logic error or missing database near ".": syntax error"

INSERT INTO Data (`test.1`, `test.2`, `test.3`) VALUES ([@test.1], [@test.3],[@test.3])

Returns

"SQL logic error or missing database no such column: @test.1"

how can i escape the dot and still use the names as parameters!?

2
  • did you try the same [ & ] for column names too? Commented Apr 8, 2015 at 11:24
  • no i did not, let me check!!! did not work.. same error as second example. Commented Apr 8, 2015 at 11:25

1 Answer 1

3

The "proper" escape character in SQLite is double quotes:

INSERT INTO Data("test.1", "test.2", "Test.3")
    VALUES ([@test1], [@test3], [@test3])

Leave the . out of the parameter name -- presumably, you have control over that.

SQLite explicitly supports the backtick for compatibility with MySQL and the square braces for compatibility with MS Access and SQL Server. (As you can see in the documentation.)

Sign up to request clarification or add additional context in comments.

1 Comment

oke whas hoping for a escaping solution. but i think this would be the best solution. now i do not need the brackets [ & ] anymore

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.