drupal stats

Copy Data from One Table to Another Table in SQL Server

June 11th, 2011 SQL Server 0 Comments


Example

Create table "Region_A"

CREATE TABLE [dbo].[Region_A](

    [RegionID] [int] IDENTITY(1,1) NOT NULL,

    [RegionDescription] [nchar](50) NOT NULL

)

Add a few rows of data for this table.

INSERT INTO [dbo].[Region_A] ([RegionDescription])

    VALUES (N'Eastern ')

 

INSERT INTO [dbo].[Region_A] ([RegionDescription])

    VALUES (N'Western ')

 

INSERT INTO [dbo].[Region_A] ([RegionDescription])

    VALUES (N'Northern')

 

INSERT INTO [dbo].[Region_A] ([RegionDescription])

    VALUES (N'Southern')

Copy data from existing table (Region_A) to new table (Region_B)

SELECT * INTO Region_B FROM Region_A

Copy  data from existing table (Region_A) to another existing table (Region_C)

Create table "Region_C"

CREATE TABLE [dbo].[Region_C](

    [RegionID] [int] IDENTITY(1,1) NOT NULL,

    [RegionDescription] [nchar](50) NOT NULL

)

Transfer data from Region_A to Region_C

INSERT INTO Region_C ([RegionDescription])

SELECT [RegionDescription] FROM Region_A

Tags: copy data from one table to another in sql, how to copy data from one table to another in sql server, copy data from one table to another, how to copy data from one table to another table in sql server, sql copy data from one table to another existing table, mssql copy large table, how to store data in another table in net, mssql how to copy data from the table to another, select data from one table and insert into another in sql using gridview in asp net, apend data from one table to another table in sql

Related posts:

  1. Generate SQL Scripts for Databases in SQL Server

No Comments