English 中文(简体)
Export multiple queries to different tables
原标题:

I need to export; Multiple queries to different tables of ms access database from ms sql.

I know it is possible by taking each query and export it to a single table and repeating the same for different queries.

What I want to know is... can it be done in one stretch?

suppose there are three queries and each query output need to be in different tables ... in that case is it possible to do with a single export?

问题回答

You can save the individual exports as SSIS packages, then combine them into a single package.

The exports might even be able to run in parallel.

I m not sure what you mean. You could put all the SQL statements into one command batch rather than executing each one separately, e.g:

insert into Table1 select ...
insert into Table2 select ...
insert into Table3 select ...

Are these passthrough queries or Jet (Access) queries? If they are Jet queries, you should create make table queries and run them as a batch through VBA. The make table queries themselves can be constructed easily enough in VBA, if you prefer. Here is an example that gets the connect string from a linked SQL Server table, but you can fill in your own connection string, it should have the same format as the connect property of a linked table.

Dim db As Database
Dim strSQL As String
Dim strConnect As String

Set db = CurrentDb
strConnect = db.TableDefs("dbo_test").Connect

strSQL = "INSERT INTO NewAccessTable (ID, Descr) " _
& "SELECT ID, Descr FROM [" & strConnect & "].[test] "

db.Execute strSQL, dbFailOnError
Debug.Print db.RecordsAffected




相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

SQL server: Can NT accounts be mapped to SQL server accounts

In our database we have an SQL server account that has the correct roles to access some of the databases. We are now switching to windows authentication and I was wondering if we can create a NT user ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签