Skip to content

Commit 6013472

Browse files
authored
SQL-469: Merge pull request #329 from jim-dotcom/backup-single-table
How to Backup a Single Table With Its Data From a Database
2 parents e31e20a + 7f3ef43 commit 6013472

File tree

5 files changed

+19
-0
lines changed

5 files changed

+19
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE DATABASE TempBackupDB;
2+
3+
USE TempBackupDB;
4+
SELECT * INTO Students FROM university.dbo.Student;
5+
6+
BACKUP DATABASE TempBackupDB TO DISK = 'C:\Backup\TempBackupDB.bak';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mysqldump -h localhost -P 3306 -u user -p university student > student_backup.sql
2+
3+
cat student_backup.sql
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pg_dump -h localhost -p 5432 -U user -d university -t student -f student_backup.sql
2+
3+
cat student_backup.sql
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pip install mssql-scripter
2+
3+
mssql-scripter -S localhost -d university -U user -P password --script-create --script-data --include-objects student --output-file student_backup.sql
4+
5+
cat student_backup.sql
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sqlpackage /Action:Export /SourceServerName:localhost /SourceDatabaseName:university /SourceUser:user /SourcePassword:password /TargetFile:student_backup.bacpac /Table:student
2+

0 commit comments

Comments
 (0)