is there any way to import NULLS to mySQL inside of single quotes?

268 views Asked by At

I'm using VBA that encloses every field with single quotes in order to import into mySQL and noticed that every variation I tried on NULL for numeric data types imported as 0. If I drop the backticks the nulls import fine, so I think my question boils down to this: if there any way to indicate NULL data inside of single quotes in a mySQL import?

this website shows a bunch of examples, but nothing inside of single quotes.

thanks!

1

There are 1 answers

0
AndreKR On BEST ANSWER

If the string inside the single quotes is escaped, too, then there is no way of making it NULL. That would negate the purpose of quotes+escaping.

If it is not escaped, you could "break out" of the single quotes with a single quote. For example if you store the string '/0+' it will become ''/0+'' (say: empty string divided by zero plus empty string) which is NULL because anything divided by zero is NULL.