Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifying an existing table in Informix

Status
Not open for further replies.

Qman61832

IS-IT--Management
Jan 23, 2003
20
US
Ok, Im sure this will sound like a dumb question to anyone who has used SQL before, but I am new to this. I did RTFM, but I cant seem to make it work...
Heres the problem - I have an existing table in my Informix SQL database called "waxcnt" - this table has fields called "user_id", "count", and "lst_acc". Basically it counts every time someone logs into the database and records the date and time, however all it displays is the username which *should* reference a specific company. The problem that I am running into is that I would like to add a fourth field called "comp_id" and be able to enter company names (Ford, Chevy, etc) into it so that when we run our reports, we can determine which companies are associated with the login IDs.
 
The sql statement for adding a new column is as follows

ALTER TABLE waxcnt
ADD comp_id CHAR(9)

you can change the CHAR(9) to whatever you need.

If you want to insert info into that new column you would need to do an update statement such as

update waxcnt
set comp_id = 'Ford'
where user_id = 'something'
 
*Much grateful bowing before Dodge20*

Works great! This will help eliminate the need for data entry to switch back and forth between screens to see what login is associate with what account...I dont mind doing a little manual entry up front if it saves me time in the long run....

Thanks again!
 
Also something that may speed up the entry process

update waxcnt
set comp_id = 'Ford'
where user_id in ('something','something','something'....)

You can list all the user_id's that you want to have Ford in the comp_id field.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top