Link to home
Start Free TrialLog in
Avatar of SeTech
SeTechFlag for United States of America

asked on

Creating a table

I have an open query that works and I want to place the data from the query into a table. I know I can use the Insert Into with an existing table, however can a table be created to store the data. In other words have a table created as you pull the data with the Open Query?

Select   *
from open query  (linked_Server,
'select Distinct * from tableXXX
 ')

So the data from tableXXX from the linked Server would go into a table that does not yet exist.
It would be analogous to using the Import Wizard, where you can import data from an excel worksheet and the wizard will create a table in a SQL Server database if it is not yet built. It is a Create Table on the fly...
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Select   * into <TableName>

 from open query  (linked_Server,
 'select Distinct * from tableXXX
  ')
if it's a linked table you could also use :
DoCmd.CopyObject , "desttablename", acTable, "sourcetablename"
I guess, this would be a np-hard job..
SeTech, do you still need help on this question?