Reputation: 1470
I have an SQL Azure Database Server with 2 databases and I need to insert records from a table of the first database to another table in the other database. Both databases are on the same server with the same security settings/login.
I have tried:
INSERT INTO DatabaseB.dbo.TableB (ColumnA, ColumnB)
SELECT TableA.ColumnA, TableA.ColumnB
FROM DatabaseA.dbo.TableA
When I run the SQL with SSMS I get:
Msg 40515, Level 15, State 1, Line 16
Reference to database and/or server name in 'DatabaseB.dbo.TableB ' is not supported in this version of SQL Server.
Upvotes: 1
Views: 150
Reputation: 71111
Cross-database queries such as the one you're trying to do aren't supported with SQL Database, except for read-only elastic queries. You'd need to execute two separate operations.
Specifics a round T-SQL differences between SQL Server and SQL Database are here.
Info about elastic queries: here.
Upvotes: 3