Click to See Complete Forum and Search --> : SQL help


Matrix.net
10-10-2006, 10:00 AM
Hi people Im working with an MSACCESS DB , my question is that I dont remember if you wrap only numeric values in single quotes or do you wrap everything with single quotes.

example would you say in a query : select name,lastName from students where studentID = '1234'

or do you also use single quotes for single characters and entire string values?

Phil Weber
10-10-2006, 10:13 AM
You do NOT wrap numeric values with single quotes, only string values. So your example should be:

SELECT name, lastName FROM students WHERE studentID = 1234

Date values, incidentally, should be surrounded by pound signs (#).

Ron Weller
10-10-2006, 08:00 PM
Like Phil said only string values get surrounded by quotes; But you can use either the
single or double Quote.
SELECT name, lastName FROM students WHERE studentID = 1234 And lastName ="Jones"

...or...

SELECT name, lastName FROM students WHERE studentID = 1234 And lastName = 'Jones'