Reputation: 4562
I used to create composite index
for my Oracle
table with the following script.
CREATE INDEX index_name ON my_table (column1,column2,column3) TABLESPACE tablespace_name;
When I tried the same in DB2
, got some errors at tablespace
and I tried using the following script simply,
CREATE INDEX index_name ON my_table (column1,column2,column3);
Is this fine in DB2
? As I am new to DB2
and no syntax found when searched for a composite index in DB2
, not sure about this. Need advice.
Upvotes: 0
Views: 2119
Reputation: 7693
For the CREATE INDEX documentation, you can check the InfoCenter: http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm.db2.luw.sql.ref.doc/doc/r0000919.html
The DB2 CREATE INDEX sentence you provided is correct. Remember that in DB2, you do not provide the tablespace at index creation. The tablespace for indexes is specified when you create the table
CREATE TABLE XX
(
...
)
IN ts_table
INDEX IN ts_indexes
For more information about the create table, please take a look at this: http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm.db2.luw.sql.ref.doc/doc/r0000927.html
Upvotes: 1