How to BCP export three related tables in a transaction consistent manner?

All we need is an easy explanation of the problem, so here it is.

Have three related tables that I would like to bcp export to file(s). This three tables have relationships to each other. Is there a good way to bcp export these tables in a transactionally consistent manner?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

how about creating a database snapshot and then running the BCP against that ?

https://docs.microsoft.com/en-us/sql/relational-databases/databases/create-a-database-snapshot-transact-sql?view=sql-server-ver15

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply