Jul 9, 2011

SQL SERVER – Copy Data From One Table to Another Table

How to copy data from one table to another table efficiently in same Database-

use [your_data_basename]


insert into[target_table_name] ([target_column_name]) select [source_column_names] from [Source_table_name]


How to copy data from one table using where condition to anther table?



 insert into[target_table_name] ([target_column_name]) select [source_column_names] from [Source_table_name] where [column_name]=value


How to copy data from one table to another table efficiently in different Databases-



insert into  [target_database_name].dbo.[target_table_name] ([target_column_name]) select [source_column_names] from [target_database_name].dbo.[Source_table_name]



How to copy data from one table using where condition to anther table from different databases-




insert into  [target_database_name].dbo.[target_table_name] ([target_column_name]) select [source_column_names] from [target_database_name].dbo.[Source_table_name] where [column_name]=value

No comments:

Post a Comment