This post was last edited by sgFengSu on 2018-12-27 16:20
Recently, when doing a project, I encountered compressing the database data into .gz files, and obtaining the compressed file for decompression and writing to the database, it is recommended to write and decompress and decompress separately into classes to call, and attach the attachment to the class found above, PS: If you use SFTP, you need to add Renci.SshNet.dll
![]()
Read sqlserver data and compress files, the main technology GZipStream compression, see https://www.itsvse.com/thread-4240-1-1.html for details
![]() Unzip the file and write it to sqlserver, the main technique For more information on GZipStream, please visit: https://www.itsvse.com/thread-4831-1-1.html SqlBulkCopy, for bulk import If there is a header, use restOfStream.StartsWith("1") to remove the header, see the last code (the old code did not use SqlBulkCopy, but wrote by executing the insert statement multiple times)
Old code - unzip the file and write to the database
|