Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
atay got a syntax error adding a composite primary key with ALTER TABLE in Informix. Jonathan Leffler guessed poor error reporting and suggested NOT NULL columns. J.C. Hunt said the first example ran once a semicolon was added after CREATE TABLE. Miran Mercun gave a CREATE TABLE with NOT NULL columns and primary key(appview, appevent) inline. No confirmation from atay.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Urgent help needed.
I am using informix db on unix and I wanted to do something as follow
(this script is a db2 script but I need an equvilant one for informix)
:
create table event_table(
appview varchar(80),
appevent varchar(80)
)
alter table event_table add constraint primary key (appview, appevent);
I keep getting syntax error at location starting at ",appevent".
I try many method such as
create table event_table(
appview varchar(80),
appevent varchar(80)
)
alter table event_table add constraint PK_testtable primary keyCLUSTERED (appview, appevent);
But it still doesn't work. PLS Help, thank in advance
--
Posted via http://dbforums.com
atay wrote:
> Urgent help needed.
> I am using informix db on unix and I wanted to do something as follow
> (this script is a db2 script but I need an equvilant one for informix)
>
> create table event_table(
> appview varchar(80),
> appevent varchar(80)
> )>
> alter table event_table add constraint primary key (appview, appevent);>
> I keep getting syntax error at location starting at ",appevent".
The best suggestion I can make is that you add NOT NULL constraints to
the columns and try again. Judging from the SQL Syntax manual, you're
using the right notation. I fear you are running foul of bad error
reporting.
If it turns out that my diagnosis is correct, please get back to me.
I already have a bug reported in the system saying "Don't generate
-201 syntax error when a better message is possible", and I'll make
sure this one gets tracked too - if I'm right.
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/
atay wrote :
> Urgent help needed.
> I am using informix db on unix and I wanted to do something as follow
> (this script is a db2 script but I need an equvilant one for informix):
>
> create table event_table(
> appview varchar(80),
> appevent varchar(80)
> )>
> alter table event_table add constraint primary key (appview, appevent);>
> I keep getting syntax error at location starting at ",appevent".
>
> I try many method such as
>
> create table event_table(
> appview varchar(80),
> appevent varchar(80)
> )>
> alter table event_table add constraint PK_testtable primary key> CLUSTERED (appview, appevent);
>
> But it still doesn't work. PLS Help, thank in advance
Does your actual script exclude a semicolon after the 'create table'
statement, as shown above? I ran your first example and it was fine -
once I added the semicolon.
--
June Hunt
Try running:
create table event_table(
appview varchar(80) not null,
appevent varchar(80) not null,
primary key(appview, appevent)
);
"atay" <member40505@dbforums.com> wrote in message news:3394310.1064060253@dbforums.com...
>
> Urgent help needed.
>
>
>
> I am using informix db on unix and I wanted to do something as follow
> (this script is a db2 script but I need an equvilant one for informix)
>
>
>
> :
>
>
>
> create table event_table(>
> appview varchar(80),
>
> appevent varchar(80)
>
>
>
> )
>
>
>
> alter table event_table add constraint primary key (appview, appevent);>
>
>
> I keep getting syntax error at location starting at ",appevent".
>
>
>
> I try many method such as
>
>
>
> create table event_table(>
> appview varchar(80),
>
> appevent varchar(80)
>
>
>
> )
>
>
>
> alter table event_table add constraint PK_testtable primary key> CLUSTERED (appview, appevent);
>
>
>
> But it still doesn't work. PLS Help, thank in advance
>
>
> --
> Posted via http://dbforums.com
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.