Page 1 of 1

SQL database problem

Posted: Wed Apr 24, 2024 12:52 pm
by Xpajun
I'm currently being driven around the bend with this problem

Inserting data into the orders table via the sql as follows:

Code: Select all

INSERT INTO orders (orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, date_purchased, orders_status, orders_date_finished, currency, currency_value, shipping_module, customer_service_id, discount_codes) VALUES
(485, 422, 'Some Customer', '', '10 Some Street', 'Somewhere', 'Someplace', 'AA1 1AA', 'Devon', 'United Kingdom', '01234567890', 'skippy1983@hotmail.co.uk', 2, 'Some Customer', '', '10 Some Street', 'Somewhere', 'Someplace', 'AA1 1AA', 'Devon', 'United Kingdom', 2, 'Some Customer', '', '10 Some Street', 'Somewhere', 'Someplace', 'AA1 1AA', 'Devon', 'United Kingdom', 2, 'Other', '', '', '', '', '2011-04-20 19:05:18', '2011-04-20 12:52:16', 3, NULL, 'GBP', 1.000000, 'rmstandardparcel_rmstandardparcel', '', '1-CaptuRe', '');

Not just the one line of code but multiple
The Static analysis come up with the following error:
#1136 - Column count doesn't match value count at row 1

46 values were expected, but found 45. (near "(" at position 1392)
No matter how I count them the Value names and the Values equal the same amount of 45

What I want to know is where the extra value name is?

Re: SQL database problem

Posted: Wed Apr 24, 2024 1:33 pm
by bonbec
Hello,
If 1-CaptuRe is the discount_code, what is the last value '' ?
Seems don't have a field.

Re: SQL database problem

Posted: Wed Apr 24, 2024 2:24 pm
by Xpajun
bonbec wrote: Wed Apr 24, 2024 1:33 pm Hello,
If 1-CaptuRe is the discount_code, what is the last value '' ?
Seems don't have a field.
1-CaptuRe is the customer_service_id last value is discount code

I think a lot of it is bad updating on my part

Re: SQL database problem

Posted: Wed Apr 24, 2024 2:40 pm
by bonbec
If I put values in front of fieldnames :
orders_id 485
customers_id 422
customers_name Some Customer
customers_company ''
customers_street_address 10 Some Street
customers_suburb Some Place
customers_city Somewhere
customers_postcode AA1 1AA
customers_state Devon
customers_country United Kingdom
customers_telephone 01884860932
customers_email_address xxxxxxxx@hotmail.co.uk
customers_address_format_id 2

delivery_name Some Customer
delivery_company ''
delivery_street_address 10 Some Street
delivery_suburb Some Place
delivery_city Somewhere
delivery_postcode AA1 1AA
delivery_state Devon
delivery_country United Kingdom
delivery_address_format_id 2

billing_name Some Customer
billing_company ''
billing_street_address 10 Some Street
billing_suburb Some Place
billing_city Somewhere

payment_method Other
cc_type ''
cc_owner ''
cc_number ''
cc_expires ''
last_modified 2011-04-20 19:05:18
date_purchased 2011-04-20 12:52:16
orders_status 3
orders_date_finished NULL
currency GBP
currency_value 1.000000
shipping_module rmstandardparcel_rmstandardparcel
customer_service_id ''
discount_codes 1-CaptuRe
?????? ''

For ?????? there is no fieldname, so I think the mistake is near customer_service_id

Re: SQL database problem

Posted: Wed Apr 24, 2024 3:20 pm
by burt
Note:
I have removed this customers details.

It is always wise to anonymize any data.

Re: SQL database problem

Posted: Wed Apr 24, 2024 3:51 pm
by bonbec
Ok, well seen. I also changed the email address in my post.

Re: SQL database problem

Posted: Fri Apr 26, 2024 5:08 pm
by Xpajun
I actually got this sorted - wasn't the first nor the last - it seems that the database errors point to something around about the line given - I spent all day yesterday working on it - find one and fix and you get another cropping up - hazzards of getting old data into a new database I suppose ;)

Re: SQL database problem

Posted: Fri Apr 26, 2024 5:10 pm
by Xpajun
burt wrote: Wed Apr 24, 2024 3:20 pm Note:
I have removed this customers details.

It is always wise to anonymize any data.
Thanks Gary brain fuzzed out when I posted