Code: Select all
&"'Epidural PCEA' text, 'Spinal' text, 'Combined Spinal/Epidural' text, 'General Anesthetic' text, 'Other Pain Mgmt' text)" into tSQL
replace "'" with quote in tSQL -- replace single quote with double quote
Thank you.
Mark
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Code: Select all
&"'Epidural PCEA' text, 'Spinal' text, 'Combined Spinal/Epidural' text, 'General Anesthetic' text, 'Other Pain Mgmt' text)" into tSQL
replace "'" with quote in tSQL -- replace single quote with double quote
marksmithhfx wrote:does anyone know how I can change "quote" in the above statement to a backtick?
Mark
Code: Select all
replace "'" with numtochar(96) in tSQL -- replace single quote with backtick
If you're on a Macbook Pro Retina, isn't it the key right below the escape key, upper left hand corner?marksmithhfx wrote:Hi, I use "quote" marks in my SQL code so that I can use non-standard characters for identifiers,
This works fine in SQLite but mySQL is complaining, I think, because I am using regular " quote marks around the identifiers. The mySQL documentation says that the identifier quote symbol is the backtick (ascii code 96). Since I don't even see a backtick on my MacBook Pro, does anyone know how I can change "quote" in the above statement to a backtick?Code: Select all
&"'Epidural PCEA' text, 'Spinal' text, 'Combined Spinal/Epidural' text, 'General Anesthetic' text, 'Other Pain Mgmt' text)" into tSQL replace "'" with quote in tSQL -- replace single quote with double quote
Thank you.
Mark
On a UK Apple keyboard it's in the bottom-left, between the SHIFT and 'Z' keysshawnblc wrote:If you're on a Macbook Pro Retina, isn't it the key right below the escape key, upper left hand corner?
Code: Select all
function q tString
return QUOTE & tString & QUOTE
end q
Code: Select all
function q2 tString
return "'" & tString & "'"
end q2
Klaus, thank you, those will come in very handy. I can even add a q3 now that uses a backtick! And Shawn, yes, thank you for pointing that out. I had not recognized it as such.Klaus wrote: 1. Put (double) quotes around a given string:2. Single quotes, escpecially handy for building SQL strings:Code: Select all
function q tString return QUOTE & tString & QUOTE end q
You get the pictureCode: Select all
function q2 tString return "'" & tString & "'" end q2
![]()
Hi Klaus, here is the SQL reference page I used http://dev.mysql.com/doc/refman/5.0/en/identifiers.html. You'll note on this page it saysKlaus wrote:I think MySQL will also accept SINGLE quotes -> q2
Isn't a backtick ` actually an ACCENT and not any kind of quote?![]()
But it also says there is a set option called ansi_quotes which allows you to use "quotes" instead of backtick. But ansi_quotes has side effects I did not understand so rather than fool with that (and besides, I was not sure if I would have permission to execute a "set" command on the on-rev server) I opted to try and get this backtick thing working. numtochar(96) worked like a charm, as would the ` char on the keyboard (once I located it). I did just test with 'single' quotes and it gave me a syntax error, but thanks for suggesting to test that anyway. Sometimes we learn something new or obvious.The identifier quote character is the backtick (“`”):
mysql> SELECT * FROM `select` WHERE `select`.id > 100;
Thanks Klaus. I wonder why the single quote marks don't work on the On-Rev server? I'll send a tech support request for info to see if that is something they can setup differently on their end. It would be nice for the SQLite code and the mySQL code to run the same without having to have difference versions.Klaus wrote:But I have always been using single quotes with MySQL in the past without having made
any settings to the database, it just worked![]()