Modify SQL table

SQL seams to have issues when we try to modify a table and preserving data,
I found it helpful to have a quick statement to do this copy, while preserving data.
It actually copy fields into new table, then rename them

NewTableName table should already been created with new structure, like adding new columns, removed not needed columns, or changing the order of columns, etc...

use YourDatabaseName
Insert into NewTableName (Columns, withValues, FromOld, table, like, CategoryeID, CategoryName, DateAdded)
Select Columns, withValues, FromOld, table, like, CategoryID, CategoryName, DateAdded from OldTableName

Views 1909 Downloads 757

'SQL', 'Modify', 'Copy', 'preserve'

Database SQL