Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Reserved word?????

    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.


    Code:
    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?
    I'm gonna find a way to download the internet if its the last thing I do...
    Prepare to bow down to me (or my grave) and call me almighty when the algorithm is finished

  • #2
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    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

  • #3
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Hey! I luv using aliases... i'm a lazy coder.
    But as far I know... headers, folders and types could not be reserved.. I've used this query umpteen times around my site.
    I'm gonna find a way to download the internet if its the last thing I do...
    Prepare to bow down to me (or my grave) and call me almighty when the algorithm is finished

  • #4
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,169
    Thanks
    19
    Thanked 65 Times in 64 Posts
    you're missing a JOIN or 3 in there...

    Code:
    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

  • #5
    Regular Coder
    Join Date
    Sep 2004
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Um...why would you SELECT TOP 0? That is not going to return any records even if the rest of the WHERE clause matches.

  • #6
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,169
    Thanks
    19
    Thanked 65 Times in 64 Posts
    Quote Originally Posted by neocool00
    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

  • #7
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts
    i mixed up some of the inputs to the function. fixed it
    I'm gonna find a way to download the internet if its the last thing I do...
    Prepare to bow down to me (or my grave) and call me almighty when the algorithm is finished


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •