Click here to Skip to main content
15,885,014 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i Can't add a query used add to tow tables in acceess
or
use the code in query
PHP
PARAMETERS  @Table1 text, @Table2 text;
Insert Into @Table2 Select * From @Table1;
Posted

You need to build your query as a string:
SQL
DECLARE @Dest varchar(20)
DECLARE @Src varchar(20)
SET @Dest = 'copydat'
SET @Src = 'myTable'
DECLARE @myQuery AS VARCHAR(200)
SET @myQuery = 'INSERT INTO ' + @Dest + ' SELECT * FROM ' + @Src

EXEC (@myQuery)
 
Share this answer
 
You can't insert in two tables from a single SQL query.

hope it helps :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900