I've got a database with 61 tables that have varying foreign keys. I'm trying to export it from SQL Server 2008 to SQL Server 2005 and keep running into problems because the export isn't smart enough to know what order the tables need to go in to not violate foreign keys. I've been trying to do a couple tables at a time, but don't know enough about things to know what order I should copy the tables in. What's the easiest way to figure out the order?
Microsoft SQL ServerMicrosoft SQL Server 2008Microsoft SQL Server 2005
@ScottPletcher, looks like a good function, but unfortunately, I'm getting the following error:
The statement terminated. The maximum recursion 100 has been exhausted before statement completion.
I ended up using the suggestions from @sjwales and @EugeneZ
Thanks
quizwedge
ASKER
I saw the suggestion from sjwales and ended up implementing one of EugeneZ's before I saw the post. I think ScottPletcher's solution would work if I gave him the opportunity to update the code, but wanted to close the question since I solved the problem. Thanks for all of the help.
The statement terminated. The maximum recursion 100 has been exhausted before statement completion.
I ended up using the suggestions from @sjwales and @EugeneZ
Thanks