Jump to content


Photo

Moving db colums to a different table


  • Please log in to reply
7 replies to this topic

#1 smith.james0

smith.james0
  • Members
  • PipPipPip
  • Advanced Member
  • 122 posts

Posted 07 July 2006 - 06:04 PM

Hi
I need to move two columns (area_servicability, company_servicability) to a new table without lossing the data, is this possible in php admin?

Second question If i change the column type will it keep all the date? (varchar(200) change to int(5,2))

Thanks James

#2 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 07 July 2006 - 06:20 PM

James, If you have phpMyAdmin, select the table you want to move/copy, select Operations on the top, go to Copy table to (database.table): select the database you would like it to be copied to, type in the name of the table, make sure you have structure and data selected and push go!

If you don't have phpMyAdmin, either install it or let me know and I can give you the sql query.

hope this helped,
-Chris

#3 smith.james0

smith.james0
  • Members
  • PipPipPip
  • Advanced Member
  • 122 posts

Posted 07 July 2006 - 08:49 PM

Is it possible to copy just two columns rather than the whole table?

Thanks James

#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 07 July 2006 - 11:26 PM

Copy the whole table and then delete the columns you don't want.

Ken

#5 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,016 posts

Posted 08 July 2006 - 09:10 AM

Second question If i change the column type will it keep all the date? (varchar(200) change to int(5,2))


valid integer values should be retained. What is int(5,2)?
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#6 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 08 July 2006 - 05:18 PM

Second question If i change the column type will it keep all the date? (varchar(200) change to int(5,2))


valid integer values should be retained. What is int(5,2)?


I believe int(5,2) would be an integer of that is 5 characters long with 2 decimals - but then it's a float and not an integer :S ???

#7 smith.james0

smith.james0
  • Members
  • PipPipPip
  • Advanced Member
  • 122 posts

Posted 09 July 2006 - 12:19 PM

Thanks for that worked first time. int(5,2) sorry I ment decimal(5,2)

Thanks James

#8 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 09 July 2006 - 03:36 PM

Ahh, well then it makes sense.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users