Question:
What errors can you spot in this SQL code?
DanCorb
2008-03-03 12:35:20 UTC
Create table 2table
(student_id number(4) primary key,
student_name char(10),
student_address varchar(100));

insert into 2table values
(12345, ‘john’, ‘washington’);

insert into 2table values (&&id, &&name,'&&address');
insert into mydata2 values (&id, &name, '&address');
Five answers:
x2000
2008-03-03 13:00:03 UTC
2table is a bad name

12345 is too big

mydata2 is not defined

Either & or && is incorrect, but I have never used that syntax before
2008-03-03 20:42:28 UTC
How To Diagnose and Correct Errors

http://www.microsoft.com/technet/prodtechnol/sql/2005/diagandcorrecterrs.mspx
woooooooopa
2008-03-03 20:40:52 UTC
You cannot start a table's name with a numeric value.
2008-03-03 22:39:39 UTC
&&address shouldn't have apostrophes ... the DB will automatically convert whatever you fill in the parameter into varchar
vandiemen007
2008-03-03 20:39:35 UTC
I don't think you can have your tables start with a number (#)


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...