changing a table's field from INTEGER to CHAR
Posted in 1994
Topics: SQL Development & Query Writing, Connectivity: ESQL/C, 4GL & Embedded SQL
Hi, c4gl, i4gl, isql, se version 2.10 386 computer running AT&T SvR3.2 Here's our situation. We have two tables 'order' and 'invoicing' Both are joined by the primary key PO (purchase order number). Here are their summary schemas: table order table invoicing PO char(5) PO char(5) . invoice_num integer . . . . This is how it works. Whenever we send out an invoice, it is always PO+nth invoice. For example if we have PO = 12345, then our invoices become 123451 to 123459. We have a problem when we have to invoice more than 9. I cannot just put '10' after '12345' bec. it will mess up the print-out reports and invoices that are sorted using the PO and the invoice number, or by invoice number alone. ex. PO - 55555, invoices - 555551, 555552, 555553...555559, 5555510(?) PO - 55556, invoices - 555561, 555562 As you can see, sorting will become 555551...555559, 555561, 555562,... ...5555510 because the field is integer. What we want is 555551... 555559, 5555510, 555561, 555562,... The only method I can think of is changing the field into a character. Are there any 'gotchas' to consider when changing a table's field to character? (besides recompiling the affected programs and forms) Is there a better way than changing the invoice table's invoice_num field from integer to character (I really like to avoid this if possible bec. there are *LOTS* of programs and forms)? I'll have to 'hunt' them :) Pls. email. Thanks! John John