Forum Moderators: open

Message Too Old, No Replies

Insert into select

         

StoutFiles

1:34 pm on Dec 7, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have two databases, A and B.

A is a read-only table.

I'm wondering if it's possible to run an "insert into select" query on Table B.

insert into B:data (B:data.test)
select A:data.test from A:data
where A:data.test = '0';

Will A be able to do this? I'd just check myself but I'm running these queries through VMS using Attunity and the error messages are archaic.

LifeinAsia

4:55 pm on Dec 7, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



It depends on what database you're using. For example, if you're using MS SQL, the following should work (assuming you have the proper permissions for both databases):
INSERT INTO b.dbo.data (test)
SELECT a.dbo.data.test
WHERE test=0

physics

5:26 pm on Dec 7, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What database engine are you using? e.g. MySQL?

StoutFiles

8:53 pm on Dec 7, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's a Historian database with OLE DB.