If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > creating a Foreign Key

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-23-07, 07:22
klata klata is offline
Registered User
 
Join Date: Jul 2007
Posts: 2
creating a Foreign Key

I am using DB2 version 7.
I am trying to execute the following stmnt on the table open_select1:

ALTER TABLE "DB2ADMIN"."OPEN_SELECT1"
ADD CONSTRAINT "FK_FORMNO" FOREIGN KEY ("FORMNO")
REFERENCES "DB2ADMIN"."COLL_GEN" ("FORMNO")
ON DELETE NO ACTION
ON UPDATE NO ACTION
ENFORCED ENABLE QUERY OPTIMIZATION;

for which i am getting the following error:

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 "ENFORCED ENABLE QUERY OPTIMIZATION" was found

following "ON UPDATE NO ACTION". Expected tokens may include: "<space>".

SQLSTATE=42601

Any help will be appreciated.

Last edited by klata; 07-23-07 at 07:26.
Reply With Quote
  #2 (permalink)  
Old 07-23-07, 08:13
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
It looks like you are using V8 syntax. You need to look up the V7 syntax. This might be hard, since V7 has been out of service and support for quite some time.

Andy
Reply With Quote
  #3 (permalink)  
Old 07-23-07, 08:40
klata klata is offline
Registered User
 
Join Date: Jul 2007
Posts: 2
Hi Andy,
thanks for the reply. Your reply has confirmed what i suspected. I was sure the problem was because of version mismatch. The scripts have been generated in version 8 and now i am trying to create the db in version 7 and i am stuck now because of this problem. I have also tried to take a backup of the version 8 db and restore in version 7 where again i have failed. Please suggest.
Reply With Quote
  #4 (permalink)  
Old 07-23-07, 08:55
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
You will have to manually edit each script to make sure that it is compatible with V7. Either that or upgrade you V7 systems to V8 or V9.

Andy
Reply With Quote
  #5 (permalink)  
Old 07-23-07, 13:44
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Restoring a V8 backup on V7 is not supported - just the other way around.

I highly recommend that you move to V8 (better V9) because you won't get any real help (and no support from IBM) for V7 any longer.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #6 (permalink)  
Old 07-24-07, 02:08
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
Quote:
Originally Posted by klata
ALTER TABLE "DB2ADMIN"."OPEN_SELECT1"
ADD CONSTRAINT "FK_FORMNO" FOREIGN KEY ("FORMNO")
REFERENCES "DB2ADMIN"."COLL_GEN" ("FORMNO")
ON DELETE NO ACTION
ON UPDATE NO ACTION
ENFORCED ENABLE QUERY OPTIMIZATION;
Hi,
"Enforced enable query optimization" is not supported in v7. Why don't you use just:
Quote:
ALTER TABLE "DB2ADMIN"."OPEN_SELECT1"
ADD CONSTRAINT "FK_FORMNO" FOREIGN KEY ("FORMNO")
REFERENCES "DB2ADMIN"."COLL_GEN" ("FORMNO")
ON DELETE NO ACTION
ON UPDATE NO ACTION
I don't think this should be a reason for migration to newer version. This "enforced" statement is just performance string. There are a couple of other thinks that is interesting in v8 and v9 to migrate.
Hope this helps,
Grofaty

Last edited by grofaty; 07-24-07 at 02:13.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On