sql 表内容复制 insert into select语法
insert into 新表(字段1,字段2,.......) select 字段1,字段2,...... from 旧表
_connect("localhost","root","123456"); mysql_select_db("db_test"); mysql_query("set names 'utf8'"); $query = mysql_query("insert into test2(id,title,date) select id,title,date from test1"); if($query){ echo "ok";exit; }
mssql 用法
--2.创建测试数据
insert into table1 values('赵','asds','90')
insert into table1 values('钱','asds','100')
insert into table1 values('孙','asds','80')
insert into table1 values('李','asds',null)
go--3.select into from语句创建表table2并复制数据
select a,c into table2 from table1
go--4.显示更新后的结果
select * from table2
go
--5.删除测试表
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号