RSS

HOW TO:: Make a BACKUP from one table OR insert a result set to another table

14 Oct

To make a copy from table to another , or if you want to insert into table result set of table use this :

USE DB
CREATE TABLE Tb_1
(
PersonID INT PRIMARY KEY,
PersonName NVARCHAR(50)
)

GO

INSERT INTO Tb_1 (1,’Ahmed’)
INSERT INTO Tb_1 (2,’Mohamed’)

INSERT INTO Tb_2
SELECT PersonID, PersonName FROM Tb_1

THANK YOU

 
4 Comments

Posted by on October 14, 2011 in MS SQL Server

 

Tags: , , , ,

4 responses to “HOW TO:: Make a BACKUP from one table OR insert a result set to another table

  1. Eng. Ahmed Negm

    October 14, 2011 at 1:46 AM

    Thanks for your information sharing Mr. Ahmed Saied.
    —————-

    You can also do this by the following T-SQL command as following:-

    SELECT *
    INTO new_table_name
    FROM old_tablename

     
    • ahmedsaid5

      October 14, 2011 at 1:49 AM

      the second one that eng Ahmed Negm shared is creating table without you create it and insert into the table that created

      THANK YOU ENG Ahmed

       
  2. Mohamed Fawzy

    October 14, 2011 at 1:48 AM

    ربنا يبارك فيك يا نجم ومن نجاح اى نجاح دايما..باذن الله

     
    • ahmedsaid5

      October 14, 2011 at 2:19 AM

      اللهم آمين

       

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

 
%d bloggers like this: