Category >
ORACLE
|| Published on :
Tuesday, August 12, 2014 || Views:
10875
||
copy from one table to another table copy data in sql server select into sql command insert into SQL Command sql tip sql tricks
Introduction:-
Here Pawan Kumar will explain While working with MS-SQL Server many times we will find some difficulties to copy the data or value from one table to another table and
In some situation, we come across with different question related to data copy from one table to another table like, How to copy data from one table to another?, How to insert the data from one table to another table? and similar sort of questions.
Description:-
In previous post I explained Get todays Day Name SQL server, how can we convert negative a number to positive number in SQL Server 2005/2008.
Now, Here we will discuss about two methods where we can use these methods to Insert or Copy the data or values from one table to another table. You can use following methods to insert the data from different databases.
Trick/Method 1: Using "INSERT INTO"
This method is mainly used to copy data or values to another table in MS-SQL Server but that tables in MS-SQL Server should be already created, it will not be createed by MS-SQL Server
INSERT INTO TableName(column1, column2)
SELECT column1, column2 FROM TableName
Trick/Method 2: Using "SELECT INTO"
This method is mainly used to copy data or values to another table in MS-SQL Server and also should have constrains same time that "ToTable" Should not be exist. In this case it will create the table in MS-SQL Server with the provided name.
SELECT column1, column2
INTO ToTableName
FROM FromTableName
WHERE column1 = our condition
Conclusion:
So, In this tutorial we have learned two method to copy or insert the data from one table to another table.
Download Source Codes