|
"Look a little further. Then next section in the DB2 SQL
Reference covers DESCRIBE TABLE."
<<SNIP>> Meanwhile I came up with this hacky workaround but
now I'll go back and revisit the DESCRIBE TABLE function.
Pseudo Code: (Hacky workaround)
# Clone the existing table adding the aliased column
execute "create table tmp_rename as (
select #{table_name}.*,
#{table_name}.#{column_name} as #{new_column_name}
from #{table_name}) definition only"
# Drop the old column
execute "Alter table tmp_rename drop column #{column_name}"
# Rename the current table
execute "RENAME table #{table_name} to tmp_oldtbl"
# Rename the new table back to old
execute "RENAME table tmp_rename to #{table_name}"
# Drop the old table
execute "Drop table tmp_oldtbl"
The copy of the table and dropping of columns and tables and rename of tables is probably very inefficient so I will take a
look at the describe function. Of course I need to copy the data
from the old to new table in these steps as well
This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.