Help----What is not right with my sql script? 
Author Message
 Help----What is not right with my sql script?

Hi,

I created a DB2 database running on Windows 2000 server.
When I was trying to create a table, it was causing an error as follows.

I am trying to find out what I am doing wrong or it is a bug on DB2 on Win2K
Any help or comment would be greatly appreciated...

---------------------------------------------------------
--      Below is my Script
---------------------------------------------------------
connect to mytest

create table lushitest1
(
a1 char(12) not null,
a2 char(12) not null,
i_no int not null,
primary key (a1,a2)
);

create table lushitest2
(
b1 char(12) not null,
a2 char(12) not null
);

 ALTER TABLE lushitest2
   FOREIGN KEY (b1,a2)
     REFERENCES lushitest1(a1,a2);

--================================================================
--           Below is The Error Messager
--================================================================
connect to mytest

   Database Connection Information

 Database server        = DB2/NT 7.2.0
 SQL authorization ID   = LUSHI
 Local database alias   = MYTEST

create table test1
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "table" was found following "create ".  Expected
tokens may include:  "TYPE".  SQLSTATE=42601

(
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "(" was found following "BEGIN-OF-STATEMENT".  
Expected tokens may include:  "<stmt_or_dcl>".  SQLSTATE=42601

a1 char(12) not null,
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "a1 char" was found following
"BEGIN-OF-STATEMENT".  Expected tokens may include:  "<values>".  
SQLSTATE=42601

a2 char(12) not null,
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "a2 char" was found following
"BEGIN-OF-STATEMENT".  Expected tokens may include:  "<values>".  
SQLSTATE=42601

i_no int not null,
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "int" was found following "i_no ".  Expected
tokens may include:  "JOIN <joined_table>".  SQLSTATE=42601

primary key (a1,a2)
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "END-OF-STATEMENT" was found following "PRIMARY
KEY (A1,a2)".  Expected tokens may include:  "JOIN <joined_table>".  
SQLSTATE=42601

);
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token ");" was found following "BEGIN-OF-STATEMENT".  
Expected tokens may include:  "<space>".  SQLSTATE=42601

create table test2
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "table" was found following "create ".  Expected
tokens may include:  "TYPE".  SQLSTATE=42601

(
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "(" was found following "BEGIN-OF-STATEMENT".  
Expected tokens may include:  "<stmt_or_dcl>".  SQLSTATE=42601

b1 char(12) not null,
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "b1 char" was found following
"BEGIN-OF-STATEMENT".  Expected tokens may include:  "<values>".  
SQLSTATE=42601

a2 char(12) not null
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "a2 char" was found following
"BEGIN-OF-STATEMENT".  Expected tokens may include:  "<values>".  
SQLSTATE=42601

);
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token ");" was found following "BEGIN-OF-STATEMENT".  
Expected tokens may include:  "<space>".  SQLSTATE=42601

ALTER TABLE test2
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "END-OF-STATEMENT" was found following "ALTER
TABLE test2".  Expected tokens may include:  "<stmt_or_dcl>".  SQLSTATE=42601

FOREIGN KEY (b1,a2)
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "END-OF-STATEMENT" was found following "FOREIGN
KEY (B1,a2)".  Expected tokens may include:  "JOIN <joined_table>".  
SQLSTATE=42601

REFERENCES test1(a1,a2);
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "(A1,a2" was found following "REFERENCES TEST1".
Expected tokens may include:  "<space>".  SQLSTATE=42601



Mon, 10 May 2004 17:25:29 GMT
 Help----What is not right with my sql script?

From command center with statement terminator = ; (command
center ->tools->tools seting-> use statement terminator character -> ;)
or from db2  ("db2 -td; -f scriptname")
see positions of the statement terminator character ";" in following text

connect to mytest user db2user using password;

create table lushitest1
(
a1 char(12) not null,
a2 char(12) not null,
i_no int not null,
primary key (a1,a2)
);

create table lushitest2
(
b1 char(12) not null,
a2 char(12) not null
);

 ALTER TABLE lushitest2
   FOREIGN KEY (b1,a2)
     REFERENCES lushitest1(a1,a2)
--  there isn't ";" after last statement in the script
----------------------------------
Script -----------------------------------
Untitled1
----------------------------------------------------------------------------
-

 Database Connection Information

 Database server        = DB2/6000 7.2.2
 SQL authorization ID   = DB2TARAN
 Local database alias   = MYTEST

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

sorry for my english
Regards
Adrian Kalicki



Mon, 10 May 2004 19:29:20 GMT
 Help----What is not right with my sql script?
Hi,

Specify termination character after each statement.

Best regards, Dmitry


Quote:
> Hi,

> I created a DB2 database running on Windows 2000 server.
> When I was trying to create a table, it was causing an error as follows.

> I am trying to find out what I am doing wrong or it is a bug on DB2 on
Win2K
> Any help or comment would be greatly appreciated...

> ---------------------------------------------------------
> --      Below is my Script
> ---------------------------------------------------------
> connect to mytest

> create table lushitest1
> (
> a1 char(12) not null,
> a2 char(12) not null,
> i_no int not null,
> primary key (a1,a2)
> );

> create table lushitest2
> (
> b1 char(12) not null,
> a2 char(12) not null
> );

>  ALTER TABLE lushitest2
>    FOREIGN KEY (b1,a2)
>      REFERENCES lushitest1(a1,a2);

> --================================================================
> --           Below is The Error Messager
> --================================================================
> connect to mytest

>    Database Connection Information

>  Database server        = DB2/NT 7.2.0
>  SQL authorization ID   = LUSHI
>  Local database alias   = MYTEST

> create table test1
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token "table" was found following "create ".
Expected
> tokens may include:  "TYPE".  SQLSTATE=42601

> (
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token "(" was found following

"BEGIN-OF-STATEMENT".

- Show quoted text -

Quote:
> Expected tokens may include:  "<stmt_or_dcl>".  SQLSTATE=42601

> a1 char(12) not null,
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token "a1 char" was found following
> "BEGIN-OF-STATEMENT".  Expected tokens may include:  "<values>".
> SQLSTATE=42601

> a2 char(12) not null,
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token "a2 char" was found following
> "BEGIN-OF-STATEMENT".  Expected tokens may include:  "<values>".
> SQLSTATE=42601

> i_no int not null,
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token "int" was found following "i_no ".  Expected
> tokens may include:  "JOIN <joined_table>".  SQLSTATE=42601

> primary key (a1,a2)
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token "END-OF-STATEMENT" was found following
"PRIMARY
> KEY (A1,a2)".  Expected tokens may include:  "JOIN <joined_table>".
> SQLSTATE=42601

> );
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token ");" was found following

"BEGIN-OF-STATEMENT".
Quote:
> Expected tokens may include:  "<space>".  SQLSTATE=42601

> create table test2
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token "table" was found following "create ".
Expected
> tokens may include:  "TYPE".  SQLSTATE=42601

> (
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token "(" was found following

"BEGIN-OF-STATEMENT".

- Show quoted text -

Quote:
> Expected tokens may include:  "<stmt_or_dcl>".  SQLSTATE=42601

> b1 char(12) not null,
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token "b1 char" was found following
> "BEGIN-OF-STATEMENT".  Expected tokens may include:  "<values>".
> SQLSTATE=42601

> a2 char(12) not null
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token "a2 char" was found following
> "BEGIN-OF-STATEMENT".  Expected tokens may include:  "<values>".
> SQLSTATE=42601

> );
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token ");" was found following

"BEGIN-OF-STATEMENT".

- Show quoted text -

Quote:
> Expected tokens may include:  "<space>".  SQLSTATE=42601

> ALTER TABLE test2
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token "END-OF-STATEMENT" was found following
"ALTER
> TABLE test2".  Expected tokens may include:  "<stmt_or_dcl>".
SQLSTATE=42601

> FOREIGN KEY (b1,a2)
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token "END-OF-STATEMENT" was found following
"FOREIGN
> KEY (B1,a2)".  Expected tokens may include:  "JOIN <joined_table>".
> SQLSTATE=42601

> REFERENCES test1(a1,a2);
> DB21034E  The command was processed as an SQL statement because it was not
a
> valid Command Line Processor command.  During SQL processing it returned:
> SQL0104N  An unexpected token "(A1,a2" was found following "REFERENCES
TEST1".
> Expected tokens may include:  "<space>".  SQLSTATE=42601



Mon, 10 May 2004 20:16:17 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Help...Am I heading in the right direction???

2. Am I using SQL right ?

3. >I am currently interested in a sql script or utilities that will convert vms

4. Create sql script and run it right away

5. Am I right?

6. Am I right?

7. Am I right?

8. Am I doing this the right way????

9. ASP limitations - am I asking the right newsgroup?

10. Am I doing this right?

11. Am I right with Clinet and Server Network Library's understanding

12. i am having a brainfreeze right now.


 
Powered by phpBB® Forum Software