First Database name like A
1:
2: CREATE DATABASE A
3:
4: USE A
5:
6:
7: CREATE TABLE StudentA
8: (
9: StudentID int identity(1,1) primary Key,
10: FirstName nvarchar(50),
11: LastName nvarchar(50)
12: )
Second Database name like B
1: CREATE DATABASE B
2:
3: USE B
4:
5: CREATE TABLE StudentB
6: (
7: StudentID int identity(1,1) primary Key,
8: FirstName nvarchar(50),
9: LastName nvarchar(50)
10: )
Note - Remember one thing both the database Table Schema should be same.
Just insert a three to four rows in StudentA table.
Copy A table data into a B Table.
1: USE B
2:
3: INSERT INTO StudentB
4: SELECT A..StudentA.FirstName,A..StudentA.LastName FROM A..StudentA
NOTE - It does not transfer the Index,foreign keys.
No comments:
Post a Comment