I'm trying to use DoCmd.TransferDatabase to export a table from MS access to a schema other than the one I'm using to run the procedure in MS Access.
The reason I'm hoping to use this method is because from my experience, this is the fastest way to export.
I know that I can use a pass through query but I think it will slow me down.
How do I specify the schema into which I'm exporting?
here's what i'm doing currently
DoCmd.TransferDatabase acExport, "ODBC", NewConnect, acTable, MatchNewTable, CurProjectName & "_MATCHTMP", False, True
How do I specify the schema into which I'm exporting?
You can't. You must link that table (again) using the schema you wish to export to. The (new) linked table can (re)named pretty much as you like.
Related
We would like to transfer data from a MS Access database to SQLite. Unfortunately, SQlite does not support the whole range of functions provided by Access.
ALTER TABLE Move DROP CONSTRAINT MoveEnum
ALTER TABLE IG_MDB_VERSION DROP COLUMN POOLART
Can anyone give us a replacement in SQLite which realizes the above two SQL statements. Thanks in advance!
If you are now able to link to the sqlite database from Access, and you can edit data with the linked tables from Access?
Then to execute your above sqlLite commands from Access?
Simply create + use what are called pass-though queries from Access. This will allow you to send/execute any valid sqlite commands from Access - including your example(s) in your question.
However before you attempt to use pass-though queries, you want to ensure that you can create linked tables from Access, and those linked tables allow you to edit data (say by clicking on a linked table in Access to sqlite, and that editing etc. works just fine from Access.
I have a stored procedure function as well as table in the SQL Server enterprise 2014. I also have data in the table. Now I need same table and data in PostgreSql(pgAdmin4).
Can anyone suggest to me the idea to migrate data to POSTGRESQL or any idea on creating the SQL script so that I can use psql to run the script?
Depending on how much data you have, you could script out the table and data. Then you could tweak the script as needed for PostgreSQL:
Right click on the SQL database > Tasks > Generate Scripts
On the "Choose Objects" screen, select your specific table then select "Next>"
On the "Set Scripting Options" screen, select "Advanced"
Find the option called "Types of data to script", then select "Schema and data" and select "OK"
Set the filename and continue through the dialog until the file is generated
Tweak the sql script for any specific PostgreSQL syntax
If there is a larger amount of data, you might look into some type of data transfer tool like SSIS.
Exporting the table structure and data as Josh Jay describes will likely require some fixes where the syntax doesn't match, but it should be doable if not tedious. Luckily there are existing conversion tools available to help.
You could also try using a foreign data wrapper to map the tables in SQL Server to a running instance of PostgreSQL. Then it's just a matter of copying tables. Depends on your needs and where each database server is located relative to one another.
The stored procedures will be far more difficult to handle unfortunately. While Oracle's pl/sql language is substantially similar to PostgreSQL's pl/pgsql, MS SQL Server/Sybase's TransactSQL dialect on the other hand is different enough to require rewrites. If the TransactSQL functions also access .Net objects, the migration task may end up far more difficult as you reimplement dependencies or find logical equivalents.
I am very new to SQL, MS Access & PostgreSQL. So this might be a very silly question but somehow I can't figure it out. I'm trying to run SQL queries in access and my data is in a PostgreSQL database table which was linked to access by my colleague earlier. When I make this simple query why do I get an error that the table doesn't exist? Is the syntax different for linked database tables? Or is the link not yet established?
You have created a Pass-Through query. This query is executed on the server, not in Access, so you need to use the original table names from the PostgreSQL database.
So it's not FROM public_tb_change but FROM tb_change.
Or maybe FROM public.tb_change, if public isn't the default schema.
I advise to rename your linked tables to the original name (remove public_), that makes things much less confusing. The schema name is automatically added by Access when linking the tables.
So I have two Access databases, let's call them myDatabase and anotherDatabase. In anotherDatabase there is a crosstab query. I want to get the results that this query produces into myDatabase without making ANY modifications to anotherDatabase or the query itself. I want myDatabase to be enitrely self-sufficient in the sense that the databases it interacts with will not have to be modified.
Could anyone give me advice on how to approach this?
Linking external tables is limited to external tables and won't allow you to get data from queries in another db.
One solution for external queries is to create a local query using the IN predicate:
SELECT * FROM myQuery IN 'c:\test\otherdb.mdb'
Use the Linked Table Manager to link the tables in anotherDatabase to myDatabase. Then you can have the query for anotherDatabase in myDatabase and just use that.
In the External Data tab (in myDatabase), click the button that says Import From Access. Except, instead of importing the table, click the radio button that says "Link to the data source by creating a linked table". Just follow the wizard and you should be all set.
You only need to link the tables that you require from your query. Another option would be to write some vba code in myDatabase that instantiates a connection to anotherDatabase and queries it, but I think that just linking the tables is a better solution with less hassle
Need to query my SQL server from Access using an ADO connection (for example), and then using something like:
Currentdb.CreateTableDef()
in Access to create a table (in Access) with the query results.
How can I do this?
Using DAO:
currentdb.execute "SELECT * INTO LocalTableName FROM SQLServerTable;"
The string inside the quotes should be identical in ADO but I don't use ADO much.
You could consider SQL DDL CREATE TEMPORARY TABLE syntax. From the Access 2007 Help:
When a TEMPORARY table is created it
is visible only within the session in
which it was created. It is
automatically deleted when the session
is terminated. Temporary tables can be
accessed by more than one user.
... my tongue is firmly embedded in my cheek :) This syntax doesn't exist in the Access Database Engine and never has. Instead, it's another example of the appalling state of the Access documentation on the engine side of the house. Caveat emptor.