• Phil Parkin (2/12/2016)


    mw112009 (2/12/2016)


    Reply to Post #1760966 from Lynn

    The answer is "YES" ( I mean I am able to modify the code )

    Why do I need the code ?

    I have to copy tables to another db ( in another server ) .

    Yes, I could do that by doing a backup and restore.

    But the script will be very handy and I can get a novice to run a script easily.

    So then the objective is to create one script that will have all the table defs.

    Hope I answered your question.

    This is easy via SSMS (right-click DB / Tasks / Generate Scripts).

    I can't understand why the thread is so long.

    +1000. And, if you setup the scripting correctly, you get all the constraints (including FKs), indexes, triggers, schema names, privs, etc, etc.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)