on 2010 May 13 1:28 PM
Hi.
I have two databases, I'd like to make a INSERT INTO database1.table ( SELECT * FROM database2.table );
Is it possible? I'd like this rather than export manually and import later. I'd like to keep the script SQL.
Request clarification before answering.
You can use proxy tables for that - have a look at the Remote Data Access feature.
Basically, you have to do the following in database 1:
Create a server that points to the other database - if you have a ODBC DSN "db2", then you might specify something like
CREATE SERVER Server2 CLASS 'SAODBC' USING 'db2';
Create an externlogin to that server (unless the user credentials are the same on both databases, then this should not be necessary), something like
CREATE EXTERNLOGIN User1 TO Server2 REMOTE LOGIN MyUser2 IDENTIFIED BY MyPwd2;
Create a proxy table for the table of interest:
CREATE EXISTING TABLE table2 at 'Server2...MyTable';
Then you can access that remote table under the name table2, such as
INSERT INTO table1
SELECT * FROM table2
ORDER BY 1;
Note, however, that the performance to access remote data might be much slower compared to local access. This is particularly true if you are joining over local and remote data. Nevertheless, this is a very useful feature.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Performance is MUCH improved in Version 12.
I need help with this and I am misunderstanding some basic concepts. I will try to keep my ignorance simple. I test my sql statements in isql sybase 10. I can never seem to get items to work. First am I thinking wrong? can I do the above in isql for testing before I write my vb6 code? or is it tested in another interface?
User | Count |
---|---|
75 | |
30 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.