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 last published in January 2006

Dig Deeper on SQL Server Stored Procedures

PRO+

Content

Find more PRO+ content and other member only offers, here.

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.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close