#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    1
    Rep Power
    0

    How to change datatype of a column with large number of data?


    I have one column which has 600000 records with char varying datatype and i want to change it to numeric type. We are successful for first 80000 records but do not change for all the 600000 records. We have used php script and stored procedure for that but do not able to do it. So there is any other way using ssh or command line for it.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,784
    Rep Power
    348
    You can't change the data type for just some rows. The datatype is an attribute of the column and thus applies to all rows equally.

    And "but do not able to do it." is not a valid Postgres error message. You need to be way more specific why your ALTER TABLE does not work
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags.
    http://forums.devshed.com/misc.php?do=bbcode#code

    Tips on how to ask better questions:
    http://tkyte.blogspot.de/2005/06/how-to-ask-questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

IMN logo majestic logo threadwatch logo seochat tools logo