Debugging Question, correcting the below code CREATE TABLE tab1 (col1 CHAR(3), c
ID: 3889637 • Letter: D
Question
Debugging Question, correcting the below code CREATE TABLE tab1 (col1 CHAR(3), col2 CHAR(20));
COMMIT;
INSERT INTO tab1 VALUES ('123', 'Red');
INSERT INTO tab1 VALUES ('456', 'Yellow');
SAVEPOINT s1 ON ROLLBACK RETAIN CURSORS;
DELETE FROM tab1 WHERE col1 = '132';
INSERT INTO tab1 VALUES ('879', 'Blue');
ROLLBACK TO SAVEPOINT s1;
INSERT INTO tab1 VALUES ('789', 'Green');
UPDATE tab1 SET col2 = ‘PURPLE’ WHERE col1 = '789';
COMMIT;
OUTPUT:
COL1 COL2
123 Red
456 Yellow
789 PURPLE
3 record(s) selected
I get the following errors:
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near 'SAVEPOINT'.
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near 'RETAIN'.
Msg 156, Level 15, State 1, Line 8
Incorrect syntax near the keyword 'TO'.
Msg 102, Level 15, State 1, Line 10
Incorrect syntax near '‘'.
Msg 102, Level 15, State 1, Line 13
Incorrect syntax near 'COL1'.
Explanation / Answer
The error occuring since your auto-commit is ON, you have to turn off your auto-commit
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.