[thelist] SQL: Can you spot the error?

rudy rudy937 at rogers.com
Tue Jul 15 00:28:03 CDT 2003

> UPDATE news SET title = 'Krispy Kreme in Maple Grove Completed.f',
> date = '7/14/2003', active = 1, article ='The new Krispy Kreme in xxxxx is
> now open for business! xxxxx was awarded a sub-contract in the
> of the popular doughnut franchise, and is currently in negations to help
> construct a restaurant in xxxx.' WHERE news_id = 3
> I've tried the date w/ and w/o the 's and neither work.
> What is wrong with this SQL statement?

you've spelled negotiations incorrectly

just kidding!!

actually, the only thing i can see is that you're using a reserved word
(date) for a column

using reserved words incorrectly will bite you in the ass in almost every

otherwise, your statement looks okay

of course, if it's microsoft access, king of the non-standard sql databases,
you'll have to use octothorps instead of single quotes to delimit your date

   update ... set ...     [date] = #2003-07-14#

(don't get me wrong, i love access... really...  sql server is way better,
but access is fine -- hey, at least it's not mysql, which has serious
standards problems of its own)

<tip type="sql">
don't play guessing games with your dates -- always specify your date
literals in ISO format, because every database understands that format, and
you will never have to depend on regional settings, locales, american versus
british interpretations, et cetera, ad nauseam


More information about the thelist mailing list