Copy the SQL table content to the new table using insertintoselect syntax (Field 1, Field 2 ,.......) select Field 1, Field 2 ,...... from old table _ connect (& quot; localhost & quot;, & quot; root & quot;, & quot; 123456 & quot;); mysql_select_db (& quot; db_tes SQL table content copy insert into select syntax
Insert into new table (Field 1, Field 2,...) select Field 1, Field 2,... from old table
_ 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 usage
-- 2. Create Test Data
Insert into table1 values ('zhao ', 'asds', '90 ')
Insert into table1 values ('money', 'asds ', '123 ')
Insert into table1 values ('sun', 'asds ', '80 ')
Insert into table1 values ('lil', 'asds ', null)
Go
-- 3. select into from statement to Create Table 2 and copy data
Select a, c into table2 from table1
Go
-- 4. display the updated result
Select * from table2
Go
-- 5. Delete the test table