Start a new topic

Line number / SQL that caused an error

[This topic is migrated from our old forums. The original author name has been removed]

If have a series of INSERTS / SQL statements, I'd like to know which line number failed. Looking at the error in the Log below, it's hard to tell. NOTE: I have changed the tables / columns / values to XXX 23:39:07 [INSERT - 1 row(s), 0.019 secs] Command processed 23:39:08 [INSERT - 1 row(s), 0.840 secs] Command processed 23:39:08 [INSERT - 0 row(s), 0.000 secs] [Error Code: 1062, SQL State: 23000] Duplicate entry 'XXX' for key 'XXX' Code: 1062 SQL State: 23000 --- Duplicate entry 'XXX' for key 'XXX' 23:39:08 [INSERT - 1 row(s), 0.018 secs] Command processed 23:39:08 [INSERT - 0 row(s), 0.000 secs] [Error Code: 1452, SQL State: 23000] Cannot add or update a child row: a foreign key constraint fails (`XXX`.`XXX`, CONSTRAINT `XXX` FOREIGN KEY (`XXX`) REFERENCES `XXX` (`XXX`) ON DELETE NO ACTION) Code: 1452 SQL State: HY000 --- Cannot add or update a child row: a foreign key constraint fails (`XXX`.`XXX`, CONSTRAINT `XXX` FOREIGN KEY (`XXX`) REFERENCES `XXX` (`XXX`) ON DELETE NO ACTION) 23:39:08 [INSERT - 0 row(s), 0.000 secs] [Error Code: 1062, SQL State: 23000] Duplicate entry 'XXX' for key 'XXX' Code: 1062 SQL State: 23000 --- Duplicate entry 'XXX' for key 'XXX' 23:39:08 [INSERT - 1 row(s), 0.048 secs] Command processed 23:39:08 [INSERT - 1 row(s), 0.020 secs] Command processed 23:39:09 [INSERT - 1 row(s), 0.977 secs] Command processed 23:39:09 [INSERT - 1 row(s), 0.078 secs] Command processed 23:39:09 [INSERT - 1 row(s), 0.026 secs] Command processed 23:39:09 [INSERT - 0 row(s), 0.000 secs] [Error Code: 1452, SQL State: 23000] Cannot add or update a child row: a foreign key constraint fails (`XXX`.`XXX`, CONSTRAINT `XXX` FOREIGN KEY (`XXX`) REFERENCES `XXX` (`XXX`) ON DELETE NO ACTION) Code: 1452 SQL State: HY000 --- Cannot add or update a child row: a foreign key constraint fails (`XXX`.`XXX`, CONSTRAINT `XXX` FOREIGN KEY (`XXX`) REFERENCES `XXX` (`XXX`) ON DELETE NO ACTION) 23:39:09 [INSERT - 1 row(s), 0.018 secs] Command processed 23:39:09 [INSERT - 1 row(s), 0.018 secs] Command processed 23:39:10 [INSERT - 1 row(s), 0.260 secs] Command processed 23:39:10 [INSERT - 1 row(s), 0.017 secs] Command processed 23:39:10 [INSERT - 0 row(s), 0.000 secs] [Error Code: 1062, SQL State: 23000] Duplicate entry 'XXX-SKL' for key 'XXX' Code: 1062 SQL State: 23000 --- Duplicate entry 'XXX' for key 'XXX' 23:39:10 [INSERT - 1 row(s), 0.036 secs] Command processed 23:39:10 [INSERT - 0 row(s), 0.000 secs] [Error Code: 1062, SQL State: 23000] Duplicate entry 'XXX' for key 'XXX' Code: 1062 SQL State: 23000 --- Duplicate entry 'XXX' for key 'XXX' 23:39:10 [INSERT - 0 row(s), 0.000 secs] [Error Code: 1062, SQL State: 23000] Duplicate entry 'XXX' for key 'XXX' Code: 1062 SQL State: 23000 --- Duplicate entry 'XXX' for key 'XXX' 23:39:10 [INSERT - 0 row(s), 0.000 secs] [Error Code: 1062, SQL State: 23000] Duplicate entry 'XXX' for key 'XXX' Code: 1062 SQL State: 23000 --- Duplicate entry 'XXX' for key 'XXX' 23:39:10 [INSERT - 1 row(s), 0.019 secs] Command processed 23:39:10 [INSERT - 1 row(s), 0.211 secs] Command processed 23:39:10 [INSERT - 1 row(s), 0.202 secs] Command processed 23:39:10 [INSERT - 1 row(s), 0.029 secs] Command processed 23:39:10 [INSERT - 1 row(s), 0.025 secs] Command processed 23:39:11 [INSERT - 1 row(s), 0.302 secs] Command processed 23:39:11 [INSERT - 1 row(s), 0.385 secs] Command processed 23:39:11 [INSERT - 1 row(s), 0.302 secs] Command processed 23:39:11 [INSERT - 1 row(s), 0.035 secs] Command processed 23:39:12 [INSERT - 1 row(s), 0.314 secs] Command processed 23:39:12 [INSERT - 1 row(s), 0.661 secs] Command processed 23:39:13 [INSERT - 1 row(s), 0.517 secs] Command processed 23:39:13 [INSERT - 1 row(s), 0.040 secs] Command processed ... 259 statement(s) executed, 250 row(s) affected, exec/fetch time: 16.918/0.000 sec [250 successful, 0 warnings, 9 errors] Edited by: Geff Chang on Aug 19, 2013 5:48 PM

[This reply is migrated from our old forums.]

Re: Line number / SQL that caused an error
Geff, Click the yellow icon in the log to highlight a statement. Regards Roger
[This reply is migrated from our old forums. The original author name has been removed]
[Attachment has been removed.]

Re: Line number / SQL that caused an error
@Roger: Thanks for that tip. However I just noticed a trivial issue. I clicked the last yellow note, and there's an extra lighlight in the previous line. (see boxed in red) Not a deal breaker though, but you might want to look into that.
[This reply is migrated from our old forums.]

Re: Line number / SQL that caused an error
Geff, The complete statement is highlighted based on its boundaries within the script. That is from the semicolon on the previous row to the semicolon at the end of it. Regards Roger