How To Backup A Complete (rows, idx, pk) MS SQL 2012 Table In VB.NET


I can’t find a cleaner way to do this… I tried to encapsulate all the logic into a single Function that returns a boolean on success/failure. Please orgive the roughness of the code!

NewTableName is just OldTableName_YYYMMDD …I could have used “SourceTableName”, but this is just the first hack at it… :)


I only have 3 source tables, so a Switch/Case is very practical in this early stage…

I’m still open to ideas, but I dug as far as I could, and I have to move on. Maybe I’ll re-visit it something more elegant comes along!


Leave a Reply

Your email address will not be published. Required fields are marked *