pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/ArtemAvramenko/SqlDump

nk crossorigen="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-9e07ff8eaaaff3a3.css" /> GitHub - ArtemAvramenko/SqlDump: Simple SQL Server database dumper · GitHub
Skip to content

ArtemAvramenko/SqlDump

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SqlDump

Simple SQL Server database dumper. Shipped as source-only NuGet package.

Installing

  • Package Manager: Install-Package SqlDump.Sources
  • .NET command line: dotnet add package SqlDump.Sources

Example

private void GenerateBackupScript(string connectionString, string outputFile)
{
    var dumper = new SqlDumper.Dumper(connectionString);
    dumper.IgnoredTableNames = new[] { "__EFMigrationsHistory", "sysdiagrams" };
    using (var writer = File.CreateText(outputFile))
    {
        dumper.Dump(writer);
    }
}

See result

Options

Property Type Default Value Note
StatementsInTransaction int 1000 0 - do not use BEGIN TRANSACTION
RowsInStatement int 100 1 - separate INSERT for each row of data
UseGoStatements bool true true - add GO after each 'COMMIT' (after each INSERT, if transactions are not explicitly used)
IgnoredTableNames string[]? null List of tables that will not be included in the dump

Support for sql_variant type

Support for the sql_variant type is still very limited and requires setting the RowsInStatement to 1.

Lecacy System.Data.SqlClient

Add SQL_CLIENT_LEGACY to project defines.

ProgressChanged Event

    dumper.ProgressChanged += (sender, e) =>
    {
        if (e.RowsDumped == 0)
        {
            logWriter.WriteLine($"Dumping {e.SchemaName}.{e.TableName}...");
        }
        if (e.RowsDumped > 0 && (e.IsCompleted || e.RowsDumped % 10000 == 0))
        {
            logWriter.WriteLine($"{e.RowsDumped} rows dumped...");
        }
        if (e.IsCompleted)
        {
            logWriter.WriteLine($"The table {e.SchemaName}.{e.TableName} has been dumped");
        }
    };

Packages

 
 
 

Contributors

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy