Will the generated scripts respect foreign key constraints?

When backing up a remote SQL Server database, will the generated scripts respect foreign key relationships? Meaning the parents rows must be created before the child rows. SSMS’s export data wizard has major issues with this. It creates a row when the primary row in the parent table wasn’t created first which causes foreign key constraint errors.

Hello Tony,

Thank you for your message.

Our application does not track foreign keys. In general, it’s not always possible due to cross-references.

However, you can disable foreign key checks during the restore process by adding after and before SQL scripts. Here are some command examples: sql server - How can foreign key constraints be temporarily disabled using T-SQL? - Stack Overflow.