Skip to content
Advertisement

Tag: string

Trimming the beginning and end of string in SQL

I have quite a long string that I want to trim the beginning and ending of. See a random example below: { “topic”: “birds”, “body”:”cool bird”, “attachment1″:”bird1”, “attachment2″:”anotherbird” } My desired output: “attachment1″:”bird1”, “attachment2″:”anotherbird” I want to keep the attachments so I would have to trim everything up to the first attachment “attachment1” and get rid of the ‘}’ as

How to escape it properly?

I have sql string written with template string syntax: I have problems with binding second param – $2 because of single quote. How should I write it properly ? Error: Error: Query failed: bind message supplies 2 parameters, but prepared statement “” requires 1 Answer I think you’re supposed to use wildcards this way:

Advertisement