To Quote or Not to Quote?
This is by far the largest issue when dealing with SQL. Depending on what datatype you are dealing with (such as a number or character string) you have to interface the database differently. Don't worry for now if you don't understand the ColdFusion tags we're mentioning here, they will be explained a later in this chapter.
Let's say you have two fields in a table called userID and Password. userID is numeric and Password is a character string. Consider the following code.
Pay close attention to the quotes when setting new variables. userID is defined as numeric so the value does not need to be quoted. However, since the Password field is a character string (like text or memo in Microsoft Access) it must be enclosed in single quotes. Date formats must also be enclosed in quotes to be inserted or updated in a table.