Dynamic create table, create index based upon a given database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • A.M. de Jong

    Dynamic create table, create index based upon a given database

    Can I dynamically (from a stored procedure) generate
    a create table script of all tables in a given database (with defaults etc)
    a create view script of all views
    a create function script of all functions
    a create index script of all indexes.
    (The result will be 4 scripts)

    Arno de Jong,
    The Netherlands.


  • David Portas

    #2
    Re: Dynamic create table, create index based upon a given database

    The following will create a script for each type of object:

    EXEC XP_CMDSHELL '"C:\Program Files\Microsoft SQL
    Server\MSSQL\Up grade\SCPTXFR" /I /D DATABASE_NAME /S SERVER_NAME /F
    C:\PATH_NAME'

    --
    David Portas
    ------------
    Please reply only to the newsgroup
    --

    "A.M. de Jong" <arnojo@wxs.n l> wrote in message
    news:bpkpq8$7vi $1@reader10.wxs .nl...[color=blue]
    > Can I dynamically (from a stored procedure) generate
    > a create table script of all tables in a given database (with defaults[/color]
    etc)[color=blue]
    > a create view script of all views
    > a create function script of all functions
    > a create index script of all indexes.
    > (The result will be 4 scripts)
    >
    > Arno de Jong,
    > The Netherlands.
    >
    >[/color]


    Comment

    Working...