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 > Primary key in a table derived from a structured type

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-18-03, 06:46
MoeliTec MoeliTec is offline
Registered User
 
Join Date: Nov 2003
Location: Belgium
Posts: 12
Primary key in a table derived from a structured type

Hey,

I have the following:

CREATE TYPE MovieType AS ( title Char(30) , year Integer, inColor Char(1) ) MODE DB2SQL

I want to do something like this:

CREATE TABLE movie OF MovieType ( REF IS movieID USER GENERATED, PRIMARY KEY (title , year))

This don't work, because title and year can be null. but how can I define title and year not to be null?
Reply With Quote
  #2 (permalink)  
Old 12-18-03, 09:04
nitingm nitingm is offline
Registered User
 
Join Date: Jul 2003
Location: Austin, TX, USA
Posts: 278
Base Definition

Hi,

The only way is to change the base definition of your table and define the wsame as not null . for eg title char(30) not null, year integer not null. This is the solution as a primary keys can't have null values.

HTH

Nitin.
__________________
HTH

Nitin

Ask the experienced rather than the learned
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