开发者

move table from one schema to another schema ?

I want to move table from one schema to another schema in开发者_JS百科 mysql , can anybody tell me how can I do this .


If both schema is on same server then Alter table can be used to move tables from one db to another.

alter table old_db.fooTable rename new_db.fooTable


Moving tables with space characters in between should be enclosed.

Example:

ALTER TABLE `schema1`.`tbl somename` 
RENAME TO  `schema2`.`tbl somename` ;


Moving fooTable from old_db_schema to new_db_schema will be a 2 step process:

Step 1:

CREATE SCHEMA new_db_schema --Assuming you do not have new schema
GO

Step 2:

ALTER SCHEMA new_db_schema
TRANSFER old_db_schema.fooTable 
GO
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜