Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Generate table scripts by SMO

Author  Topic 

manishkaushik
Starting Member

14 Posts

Posted - 2008-10-25 : 08:01:28
Hi Guys,

I am using SMO object for generating script in SQL 2008, how ever I am successfully getting the script of all the tables.
but when i execute those script it fails, as few of the table are having relations.

I know its because the child table are created first and it seek for the parent table , where as the script for the parent table are some where later in the script.

Please advice how can i make such like that, when i create any table first its parent should be created.


Thanks
Manish

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2008-10-27 : 15:13:45
is it possible for you to create the tables first, insert data and then run script to create constraints on the tables?
Go to Top of Page
   

- Advertisement -