0

ERROR : near "s": syntax error (code 1): , while compiling: DELETE FROM 'sp_downloadfile' WHERE filename='It's Easy to be Happy'

Exel Staderlin
  • 535
  • 7
  • 10
  • 1
    Use escape character (slash \) filename = 'it\'s ... – Shadow Droid Dec 26 '19 at 08:47
  • 1
    Here` DELETE FROM 'sp_downloadfile' WHERE filename='It''s Easy to be Happy'` – Ed Bangga Dec 26 '19 at 08:48
  • 1
    Does the literal value is inserted into the query text directly or like a parameter? When directly then double each inner quote, when like a parameter then wrap it with REPLACE() function which will replace each single quote with doubled one. – Akina Dec 26 '19 at 08:55

1 Answers1

1

You can use DatabaseUtils.sqlEscapeString()

Saurabh Thorat
  • 18,131
  • 5
  • 53
  • 70
hoangnh
  • 249
  • 4
  • 13