Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2014
    Posts
    294

    Unanswered: update a table based up on its Index in db2.

    Hi,

    how to create an index of a table at runtime in db2.
    How to update a table based up on its Index in db2.
    In sql server

    UPDATE ['+@db_name+'].'+@table_name+
    ' SET ' + @set_str +
    ' FROM ['+@db_name+'].'+@table_name+' WITH (INDEX(M_IDXAGFAF))'+
    ' WHERE m_cid = @AGFKJAGFK'


    I am trying to write the same query on db2,
    can some help me

    Thanks
    Last edited by HABBIE; 10-16-14 at 10:01.

  2. #2
    Join Date
    Sep 2013
    Location
    India
    Posts
    246
    update a table based up on its Index in db2. ...???

    Reg. the above doubt... When you update any column(s) of a table and provide a predicate in WHERE clause Db2 automatically use the index provided index is already built on that predicate column.



    create an index of a table at runtime in db2.???

    Do you want to to create index dynamically using any proc. etc ??
    ssumit

  3. #3
    Join Date
    Jul 2014
    Posts
    294
    Sumit,

    Thanks for the reply.
    Yes I am trying to create an index dynamically using some procedure itself. I am new to this db2 , so can't find enough solution for this.

  4. #4
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    EXECUTE IMMEDIATE 'CREATE INDEX ' || yourSchema || '.' || yourIndexName || ' ON ' ...
    Florin Aparaschivei
    DB2 9.7, 10.5 on Windows
    Iasi, Romania

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •