tofutim
tofutim

Reputation: 23374

How can I insert data from SQL Server to SQL Azure?

I would like to write a query with data based on a SQL Server table and insert the results into a SQL Azure table. Is this possible in SQL Server Management Studio?

For example:

SELECT stuff
INTO AzureTable
FROM SqlServerTable

Upvotes: 3

Views: 1734

Answers (1)

anon
anon

Reputation:

I suppose it's possible to do something similar to that with a linked server to your SQL Azure host, but using SELECT INTO explicitly will not work - you'd need the destination table to exist first (see this MSDN blog post where they describe why SELECT INTO is not supported in SQL Azure).

If the destination tables don't already exist, you can script the objects in Management Studio (as described here) or use tools like SQL Compare from Red Gate to do the grunt work for you.

Once the destination tables exist, you can just write insert statements (again assuming a linked server) or you could use a slightly different approach. For example, have you looked at the SQL Azure Migration Wizard on Codeplex or SQL Data Compare from Red Gate?

Upvotes: 2

Related Questions