Change table query in Informix DB

DBMS: Informix.

I have a sample_tbl table with 5 3 fields that:

  • user_id
  • user_name,
  • user_email

Now I want to add the following fields to sample_tbl with one single query to add columns. New fields:

  • user_phone_no,
  • USER_LOCATION,
  • user_password

I want to add user_phone_no after user_id, and I want to add user_location, user_password after user_email field and all with one request. Any suggestion for this?

+3
source share
1 answer

According to interactive documents IBM Informix v10 allows ALTER TABLE ADD column BEFORE existing_column.

So something like this might work (I don't have Informix connection on this computer) ...

ALTER TABLE sample_tbl
ADD user_phone_no varchar(10) BEFORE user_name,
ADD user_location varchar(10),
ADD user_password varchar(10);
+12
source

Source: https://habr.com/ru/post/1789206/


All Articles