SQL Server – Copy Table from 1 Database to another


—————————————————-
Method : 1
—————————————————-

USE PropertyIdea
GO
—-Create Table
CREATE TABLE Country (CountryID int, Country nvarchar(50),Code int)

—-INSERT INTO Country using SELECT
INSERT INTO Country (CountryID , Country ,Code)
SELECT CountryID , Country ,Code
FROM [Kunj.Corp].[dbo].[Country]

—-Verify that Data in Country
SELECT * FROM Country

—————————————————-
Method : 2
—————————————————-
USE PropertyIdea
GO

—-Create Table

CREATE TABLE Country (CountryID
int, Country nvarchar(50),Code int)

—INSERT INTO Country using SELECT

INSERT INTO Country (CountryID, Country ,Code)

SELECT CountryID , Country ,Code

FROM [Kunj.Corp].[dbo].[Country]

—-Verify that Data in Country

SELECT * FROM Country

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s