Home Forums SQL Server 2005 Development Dynamic Stored Proc to generate Create Table Script ,taking table_name as parameter RE: Dynamic Stored Proc to generate Create Table Script ,taking table_name as parameter

  • There is a SQL Server 2008 forum where you might get a better answer for that part of your question.

    As for SQL2005, although it is easy to do from SMO, Tables are one of the few common SQL objects that you cannot generate a script for with just SQL, right out of the box. There are some custom stored procedures around that might be sufficient for you, I'll let those more familiar with them comment on that.

    The other way to go, would be to write a CLR UDF that just called SMO and returned the script. I have thought about writing such a Function, and might in the near future.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]