Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 "Error: near line 31: SQL logic error or missing d

Author  Topic 

Zajcica
Starting Member

22 Posts

Posted - 2014-04-10 : 10:46:15
Hello!
I am getting next error:

"Error: near line 31: SQL logic error or missing database"

And here is the code:

BEGIN TRANSACTION;


drop table owner;
drop table dog;


/* Create a table called NAMES */
CREATE TABLE OWNER(
id integer PRIMARY KEY,
name varchar2(30),
surname varchar2(30),
age number(3)
);
CREATE TABLE DOG(
id integer PRIMARY KEY,
name varchar(30),
OWNER integer
);

/* Create few records in this table */
INSERT INTO OWNER VALUES(1,'Tom', 'Cruise', 15);
INSERT INTO OWNER VALUES(2,'Lucy', 'Life', 16);
INSERT INTO OWNER VALUES(3,'Frank','Eyre', 20);
INSERT INTO OWNER VALUES(4,'Robert', 'Smith', 21);
COMMIT;
INSERT INTO DOG VALUES(1, 'Mem', 1);
INSERT INTO DOG VALUES(2, 'Rex', 2);
INSERT INTO DOG VALUES(3, 'Son', 3);
INSERT INTO DOG VALUES(4, 'Mor', 4);
COMMIT;


/* Display all the records from the table */

SELECT owner.name, dog.name from owner, dog where owner.id=dog.owner;

I do not see anything near line 31.
Please, can someone help?
Many thanks!!!

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2014-04-10 : 10:51:07
the second commit has no begin transaction


Too old to Rock'n'Roll too young to die.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2014-04-10 : 10:53:03
varchar2 ? is it ORACLE?

we are on MS SQL server only in these forums


Too old to Rock'n'Roll too young to die.
Go to Top of Page

Zajcica
Starting Member

22 Posts

Posted - 2014-04-10 : 12:21:31
Hello!
Thanks!
Please, what means that second commit has no transaction? Many thanks!
Go to Top of Page
   

- Advertisement -