我创建了很多视图,视图又创建了子视图,甚至子视图又创建了子子视图,视图之间相互引用,然后我导出SQL脚本以后,这个导出的脚本执行会出错,因为导出的SQL脚本没有按照视图引用和被引用的顺序来导出!
有没有办法或者工具能够按照视图之间的引用关系依次导出SQL脚本!!

解决方案 »

  1.   

    类BOM把视图间的关系做一个表出来,嘿嘿
      

  2.   

    Some users have tried to write their own code to generate the sql script, I suggest that you take a look at this article:Script Views by Dependancy
    http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=533Additionally, it seems that Red Gate's SQL Compare and SQL Packager have addressed this issue. You may want to refer to this article for more information:http://www.codeproject.com/showcase/RedGate_sysdepends.asphttp://databasejournal.com/features/mssql/article.php/3501361
      

  3.   

    把所有视图生成脚本--创建/不用drop 
    --------
    执行几次就行了。。存在时会提示不用理