Q

Using three part names to reference data in a separate database

Find out how to recreate data from one database into another database.

I want to create tables from one database into another database through a stored procedure- eg: I want to create all the tables in Pubs that are created on a particular date into my Northwind database (all the data that were in Pubs table must be duplicated into the Northwind database tables) - how is this done?

You need a query like the following:


CREATE PROC dbo.CopyAuthors
AS
SELECT * INTO Northwind.dbo.authors
FROM authors
GO

EXEC dbo.CopyAuthors
GO

This was first published in January 2006

Dig deeper on SQL Server Stored Procedures

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close