Thursday, 28 May 2015

copy tables with data from Current Database to another database in SQL Server Sytax

Suppose you have a table with some data in a Database A and you want to copy this data to a table in Database B .

then you should use the following syntax:

USE DatabaseB;

INTO NewTable
FROM DatabaseA.Schemaname.OldTable
Here NewTable and OldTable are two similar tables in different databases.
While handling different databases we must use fully qualified names
 to reach correct tables.

No comments:

Post a Comment