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

    Unanswered: Alter statement on a NICKNAME of an object

    Hi,

    I am trying to alter a table based on its nickname.I am facing this error.
    can some one tel me how can i go with this.

    CREATE NICKNAME N1 FOR SAMPLE.ORANGE.EMP;

    ALTER TABLE N1 ADD COLUMN ID INTEGER NOT NULL WITH DEFAULT 0 ;

    ERROR;

    The statement references "N1" which identifies a(n) "NICKNAME" rather than a(n) "TABLE".. SQLCODE=-159, SQLSTATE=42809, DRIVER=3.67.28


    can some one can give the exact syntax to add a column to the table using its nickname
    as ALTER NICKNAME ADD COLUMN
    Last edited by HABBIE; 11-19-14 at 07:12.

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    as indicated before : the nickname is a shadow of a real table
    the columns can not be changed, only the datatype mapping
    drop nickname-create nickname will reflect changes to base table

    ALL doc is in the infocenter
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Jul 2014
    Posts
    294
    Is there any way so that I can alter my remote database tables? I got my full privileges. I am trying to alter the remote database(same server) tables.

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Look up SET PASSTHRU in the documentation.

    Andy

  5. #5
    Join Date
    Jul 2014
    Posts
    294
    Andy,

    Thank you so much. Its working. using PASSTHRU i can able to alter remote database tables too.

  6. #6
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    You need to be extremely careful using it. You can mess up things real easy if you do not handle it correctly.

    Andy

  7. #7
    Join Date
    Jul 2014
    Posts
    294
    Sure Andy.
    I am trying to handle this. I have lots of tables in my database.I am working on a single table.
    I embedded this in a procedure. When i am running this I am getting the below error.
    can u please let me know what I have to do for this error.

    DB2 SQL Error: SQLCODE=-1822, SQLSTATE=560BD, SQLERRMC=07001;SAMPLE;func="SQLExecute" msg=" CLI0100E Wrong number of paramet, DRIVER=4.17.30
    Run of routine failed.
    Last edited by HABBIE; 11-21-14 at 02:42.

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
  •