How to export structure of view

  • Can any one tell me how to export structure of views without any data.

    Thanks  in advance

  • I usually use Query Analyzer's Object Browser, find the view (or any other object) right click on it and select one of the scripting options available there.  You can also use Enterprise manager to script objects, this is easier if you have multiple objects to script.  Again right click on the object and under the "All Tasks" select Generate SQL Script.  A new dialog box will show up and allow you to choose which objects to script and various options.

    /*****************

    If most people are not willing to see the difficulty, this is mainly because, consciously or unconsciously, they assume that it will be they who will settle these questions for the others, and because they are convinced of their own capacity to do this. -Friedrich August von Hayek

    *****************/

  • >Can any one tell me how to export structure of views without any data.

    views do not have any data in them when you export them its the definition that is moved.but otherwise do what is written above by dcpeterson to move the structure


    Everything you can imagine is real.

  • SELECT distinct   o.name, c.colid, c.name ColumnName, t.name, c.length

       FROM  sysobjects o

        JOIN sysdepends d

         ON depid = o.id

        JOIN syscolumns c

         ON o.id = c.id  

        JOIN systypes t

          ON c.xtype = t.xtype 

        WHERE  o.xtype = 'V'

     

     

    Leah Kats

  • Here's a real easy way to get schema of view resultset

     

    select top 0 * into TempTableName from ViewName

     

    Then just do normal scripting of object and then drop TempTableName.

     

    -Paul

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply