If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > Change column datatype in sybase IQ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-18-11, 15:38
ranzith ranzith is offline
Registered User
 
Join Date: Jul 2011
Posts: 1
Change column datatype in sybase IQ

Hi,

I am trying to change the datatype of an existing column in sybase IQ.

seems sybase IQ dont support alter table <table name> modify <col> <datatype> format to change the column datatype.

After some investigation I could find two ways to achive this. Please let me know if there are any other better ways to do an 'inplace' datatype change on a column. In some other DBs(MySQL i suppose) there is a way to specify after or before a specific column so that a new column will be created relative to that column. Is something similar available in sybase IQ.


1.Create a new column, copy data from old column, drop old column and rename new column to old column.

Pros: all the indexes , constraints, permissions etc on table will remain in tact and we need not create them
Cons: The new column will be added to the end of the table


2.Take a copy of entire table, drop the entire table and recreate with required modification, copy data back.

Pros: we will get the column name at the place we want
Cons: we have to recreate indices, constraints, permissions, keys etc on the table (we need to make sure we back up these too before we drop main table)
Reply With Quote
Reply

Tags
datatype change, sybase iq

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On