John wrote:
> Hi
>
> I have an insert sql that inserts selected records from one table into
> another. Is there a way to specify in the insert statement that one table is
> from one database and the second table is from another database i.e. insert
> is between tables of two separate databases?
depends on the database system used. If you use sqlserver, and you have
both catalogs in the same server, you can do:
INSERT INTO [cataloga].[schemaowner].[table] (field1, field2,...)
SELECT field1, field2, ...
FROM [catalogb].[schemaowner].[table]
where...
schemaowner is usuablly 'dbo'
If they're on separate boxes, you can link one server into another
server. You then get yet another name in front of the table name:
...
FROM [server].[catalogb].[schemaowner].[table]...
FB
--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website:
http://www.llblgen.com
My .NET blog:
http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------