Here are all the tables that are not referenced by a foreign key:
select name
from sys.tables
where type = 'u'
and object_id not in
(
select referenced_object_id
from sys.foreign_key_columns
)
That will give you a list of all tables that are not referenced. To get a list of tables that are referenced (and should be created first), here would be the code:
select name
from sys.tables
where type = 'u'
and object_id in
(
select referenced_object_id
from sys.foreign_key_columns
)
To get a list of tables that do not have any foreign key constraint (and therefore no dependency) run this code:
select name
from sys.tables
where type = 'u'
and object_id not in
(
select parent_object_id
from sys.foreign_key_columns
)