INSERT statement contains fewer items than the insert list

Ask a Question related to ASP, Design and Development.

  1. #1

    Default INSERT statement contains fewer items than the insert list

    The block of code below shows how I am inserting field values into my
    dbase table:

    strSQLStatement = "INSERT INTO tblArticles
    (handid,ArticleDate,sport,articleheader, fpick,articleText) "_
    & "SELECT '" & handid & "' As handid, '" _
    & ArticleDate & "' As ArticleDate, '" _
    & sport & " As sport, " _
    & articleheader & "' As articleheader, '" _
    & fpick & "' As fpick, '" _
    & articleText & "' As articleText;"

    Conn.Execute(strSQLStatement)

    ...but I am getting an "Insert statement contains fewer items than the
    insert list" error , when in fact I am not (both 6 field names).

    ????
    Muench

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    J. Muenchbourg Guest

  2. Similar Questions and Discussions

    1. Help with INSERT INTO statement
      I'm getting the following error on a query. I haven't seen this one before. Any ideas on what I'm doing wrong? Thanks. Error Executing Database...
    2. problem with insert statement
      HI there it seems like i get the error when inserting records into a MS Access database if the fields are null. : Error Executing Database...
    3. Trouble with INSERT statement
      I'm trying to create my very first INSERT statement, but I keep getting an error and I can't figure out why. The error: Syntax error in INSERT...
    4. insert statement into a mySQL dB from PHP
      I have an insert statement into a mySQL db from PHP 99% of the time the statement executes properly but occasionally no write to the db occurs,...
    5. Insert Statement help
      Hello, I am having some difficulty keeping my data consistent throughout my tables. I have 3 tables that I need to be "synch'd up"....
  3. #2

    Default Re: INSERT statement contains fewer items than the insert list

    On Tue, 30 Sep 2003 13:06:31 -0700, J. Muenchbourg <jodaddy@canada.com> wrote:
    >The block of code below shows how I am inserting field values into my
    >dbase table:
    >
    >strSQLStatement = "INSERT INTO tblArticles
    >(handid,ArticleDate,sport,articleheader, fpick,articleText) "_
    > & "SELECT '" & handid & "' As handid, '" _
    > & ArticleDate & "' As ArticleDate, '" _
    > & sport & " As sport, " _
    > & articleheader & "' As articleheader, '" _
    > & fpick & "' As fpick, '" _
    > & articleText & "' As articleText;"
    >
    > Conn.Execute(strSQLStatement)
    >
    >..but I am getting an "Insert statement contains fewer items than the
    >insert list" error , when in fact I am not (both 6 field names).
    >
    >????
    >Muench
    >
    >*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    >Don't just participate in USENET...get rewarded for it!
    Try a
    Response.Write (strSQLStatement)
    to see if perhaps the quotes or commas are getting misplaced...



    Turkbear Guest

  4. #3

    Default Re: INSERT statement contains fewer items than the insert list

    "J. Muenchbourg" <jodaddy@canada.com> wrote in message
    news:uMJUY54hDHA.2320@TK2MSFTNGP12.phx.gbl...
    > The block of code below shows how I am inserting field values into my
    > dbase table:
    >
    > strSQLStatement = "INSERT INTO tblArticles
    > (handid,ArticleDate,sport,articleheader, fpick,articleText) "_
    > & "SELECT '" & handid & "' As handid, '" _
    > & ArticleDate & "' As ArticleDate, '" _
    > & sport & " As sport, " _
    > & articleheader & "' As articleheader, '" _
    > & fpick & "' As fpick, '" _
    > & articleText & "' As articleText;"
    >
    > Conn.Execute(strSQLStatement)
    >
    > ..but I am getting an "Insert statement contains fewer items than the
    > insert list" error , when in fact I am not (both 6 field names).
    >
    > ????
    > Muench
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!
    Try this:

    strSQLStatement = "INSERT INTO tblArticles
    > (handid,ArticleDate,sport,articleheader, fpick,articleText) "_
    > & "VALUES (" & handid & ", " _
    > & ArticleDate & ", " _
    > & sport & ", " _
    > & articleheader & ", " _
    > & fpick & ", " _
    > & articleText & ")"

    Harry Strybos Guest

  5. #4

    Default Re: INSERT statement contains fewer items than the insert list

    Uh, did you mean

    strSQLStatement = "INSERT tblArticles (handid, ...) VALUES('" & handid & "',
    ....)"

    (I've never seen As used for aliases in an *insert* statement; not saying
    that it wouldn't work, but it looks weird, and bloats your code
    unnecessarily.)

    Also, a good debugging technique, as always, is

    Response.Write (strSQLStatement)

    In this case, you are very likely to spot the problem without having to post
    a message at all. And when you do have to post a message, you give us more
    useful information than an unpopulated SQL statement...







    "J. Muenchbourg" <jodaddy@canada.com> wrote in message
    news:uMJUY54hDHA.2320@TK2MSFTNGP12.phx.gbl...
    > The block of code below shows how I am inserting field values into my
    > dbase table:
    >
    > strSQLStatement = "INSERT INTO tblArticles
    > (handid,ArticleDate,sport,articleheader, fpick,articleText) "_
    > & "SELECT '" & handid & "' As handid, '" _
    > & ArticleDate & "' As ArticleDate, '" _
    > & sport & " As sport, " _
    > & articleheader & "' As articleheader, '" _
    > & fpick & "' As fpick, '" _
    > & articleText & "' As articleText;"
    >
    > Conn.Execute(strSQLStatement)
    >
    > ..but I am getting an "Insert statement contains fewer items than the
    > insert list" error , when in fact I am not (both 6 field names).
    >
    > ????
    > Muench
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Aaron Bertrand - MVP Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139