select into简单的表备份

1:MSSQL的用法:

select [字段或*] into  backTableName  from  sourceTableName   where [条件]
注:MSSQL当没有backTableName时会自动创建表。
2:MYSQL的用法:
首先mysql不支持 select into这样的写法。官网的说明是用insert into ....select...如下:
insert into backTableName [字段] select [字段] from sourceTableName where[条件] 
但这个写法有一个问题就是backTableName必须要先创建,而不是自动创建。想要创建可以用create table代替如下:
create table backTableName  select [字段] from sourceTableName where [条件]

猜你喜欢

转载自hepx.iteye.com/blog/1638027