The selected database contains foreign keys that create a cycle

You may get the following error when creating data scripts with MSSQL 2008: The selected database contains foreign keys that create a cycle. Publishing data only is not supported for databases with cyclical foreign key relationships. This problem is caused by self-referencing tables and it is given even if you don’t export data from one of such tables. Here is simple and very dirty solution.

If some of tables in the list of exported tables has circular references or some of these tables refers to table with circular references then this error occurs. As a very dirty workaround you can temporarily remove circular foreign keys and create them later again. Not very nice solution but works for me.

1 Comment

Comments have been disabled for this content.