SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    minister of propaganda silver trophy Rynoguill's Avatar
    Join Date
    Feb 2004
    Location
    Midsouth
    Posts
    1,373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    sql syntax question

    hey guys, just a quick question.

    im used to access queries, so im not sure what the deal is here. using mysql, v4.1 i beleive:
    Code:
     Error Executing Database Query.
    General error: Column count doesn't match value count at row 1
     
    The error occurred in C:\Inetpub\wwwroot\cb\www\Manage\cfcs\ImportInventory.cfc: line 158
    Called from C:\Inetpub\wwwroot\cb\www\Testing\ImportInventoryTest.cfm: line 9
    Called from C:\Inetpub\wwwroot\cb\www\Manage\cfcs\ImportInventory.cfc: line 158
    Called from C:\Inetpub\wwwroot\cb\www\Testing\ImportInventoryTest.cfm: line 9
    
    156 : 						comp_ten --->)
    157 : 						
    158 : 						VALUES (#Variables.TempQuery.Item_num#
    
    SQL 	   INSERT INTO Products (Item_num) VALUES ()
    DATASOURCE 	  CBProducts
    VENDORERRORCODE 	  1136
    SQLSTATE 	  S1000
    you can see there my sql statement, basically item_num doesnt have a value. so how would i put that in? its an int field, so it shouldnt have single quotes around it?

    thanks for any help
    rynoguill
    Ryan Guill, AKA Mark Roman

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    INSERT INTO Products (Item_num) VALUES (3)

    ?

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    yes, that's right, it should not have quotes around it

    i don't think this is valid --> #Variables.TempQuery.Item_num#

    at least, i've never seen a three-level qualified CF variable before

    should it perhaps be #Variables.Item_num# ?

    what about #TempQuery.Item_num# ?

    and, um, what good is a row in the products table with only an item number?

    are there any other columns in the table? do they all allow NULL or have a DEFAULT defined?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    minister of propaganda silver trophy Rynoguill's Avatar
    Join Date
    Feb 2004
    Location
    Midsouth
    Posts
    1,373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937
    i don't think this is valid --> #Variables.TempQuery.Item_num#

    at least, i've never seen a three-level qualified CF variable before
    actually you can have an unlimited level variable. what you see there is a query stored in variables.tempquery which i am then referencing the item number of. and yes, i agree, what good would a table with just an item number in it be, especially if it could be a record without one? lol, youre right, it has MANY more columns to it but i was having problems with it and taking out columns to try to find my problem.

    i think youve got the answer there with the not null, its not allowing null values.

    thanks rudy!

    ill tell you more about multi level variables if you want, i use them ALL the time
    rynoguill
    Ryan Guill, AKA Mark Roman

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    thanks for the offer, but i doubt i'd understand multi-level variables

    that just sounds way too complex for me

    heck, i don't even do structures

    arrays is pretty much pushing the envelope for me
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  6. #6
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Oh, man, variably named variables are just great. I was so happy to be able to use them in PHP when I realized it could do that, and languages I had used before couldn't.

  7. #7
    minister of propaganda silver trophy Rynoguill's Avatar
    Join Date
    Feb 2004
    Location
    Midsouth
    Posts
    1,373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its just containers inside containers, im sure someone of your db knowledge could catch on quick enough
    rynoguill
    Ryan Guill, AKA Mark Roman


Bookmarks

Posting Permissions

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