...

View Full Version : Reserved word?????



jaywhy13
08-22-2005, 04:02 PM
I get this error...
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.



SELECT TOP 0 h.aId, h.typeId, h.aTitle, pA.publishDate, h.aAuthor, h.aIcon FROM headers h, publishedArticles pA, folders f, types t WHERE pA.aId = h.aId AND h.typeId = t.typeId AND t.folderId = f.folderId AND h.typeId = 18 ORDER BY pA.publishDate DESC
What have I done wrong? :eek:

ghell
08-22-2005, 04:18 PM
take out the useless aliases eg headers h can just be headers

if this does not solve the problem then try simplifying the sql into test parts to see which word is reserved

once you know which word is reserved you can just call it like [headers] if it is called headers in the database.. this goes for asp variables as well for exaample if you want to do date = "i wonder what the date is" when u write date it is writing Date() so u write [date] but really u should just rename the variable so something like strDate in asp :thumbsup:

jaywhy13
08-22-2005, 04:22 PM
Hey! :eek: I luv using aliases... i'm a lazy coder. :D
But as far I know... headers, folders and types could not be reserved.. I've used this query umpteen times around my site.

NancyJ
08-22-2005, 04:46 PM
you're missing a JOIN or 3 in there...



SELECT TOP 0 h.aId, h.typeId, h.aTitle, pA.publishDate, h.aAuthor, h.aIcon
FROM headers h
INNER JOIN publishedArticles pA ON
pA.aId = h.aId
INNER JOIN types t
ON h.typeId = t.typeId
INNER JOIN folders f
ON t.folderId = f.folderId
WHERE h.typeId = 18
ORDER BY pA.publishDate DESC


or something like that

neocool00
08-22-2005, 05:20 PM
Um...why would you SELECT TOP 0? That is not going to return any records even if the rest of the WHERE clause matches.

NancyJ
08-22-2005, 08:53 PM
Um...why would you SELECT TOP 0? That is not going to return any records even if the rest of the WHERE clause matches.
doh! I cant believe I missed that... I'm guessing thats probably what the issue is lol

jaywhy13
08-23-2005, 03:53 AM
i mixed up some of the inputs to the function. fixed it



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum