Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

SQL single quotes being removed

I am building an SQL string to be executed. It contains the supplier name enclosed in single quote, as the supplier name is often multiple words.

When I use Print to display my SQL, it shows the single quotes around the supplier name, but when I execute it I receive an error message containing the SQL string where the single quotes have disappeared.

The two dialogs in the following image show the problem:

Dialogs showing single quotes are being stripped

What am I doing wrong?

SQL single quotes being removed

I am building an SQL string to be executed. It contains the supplier name enclosed in single quote, as the supplier name is often multiple words.

When I use Print to display my SQL, it shows the single quotes around the supplier name, but when I execute it I receive an error message containing the SQL string where the single quotes have disappeared.

The two dialogs in the following image show the problem:

Dialogs showing single quotes are being stripped

The following dialog shows the result when I use two single quotes, which I tried on the principle that one pair might be stripped, leaving the remaining pair to do their work. Note that neither of the single quotes has been removed:

SQL string with two single quotes

What am I doing wrong?