PDA

Click to See Complete Forum and Search --> : SQL copy data from column


Astro
Oct 5th, 2005, 01:01 PM
hello there,

how is it possible that i can copy data from an entire column (A) into another column (B), within the same table.

i am doing this because i have difficulties in renaming columns.

thank you very much.

note: MS Access 03 VBA

Astro.

dannymking
Oct 5th, 2005, 01:53 PM
With SQL?

Two calls..

CurrentDb.Execute "ALTER TABLE tablename ADD COLUMN NewField type NULL"
CurrentDb.Execute "UPDATE tablename SET NewField=OldField"


Where type in the first SQL represents the field type that you are creating...

For more info try ALTER TABLE - SQL Command (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_foxhelp9/html/3c5a454a-67ec-48a8-8290-18dd0e8a97ea.asp)

Although this relates more to SQL Server it is possible to do this as a Hidden SQL option on Access