Creating Views without Compile

  • I have 2 databases. I need to create all the views from database1 to database2. There are total 800 views and some views depend on other views.

    Example : viewA is used in ViewB. If ViewB is first executed i am getting invalid object name viewA.

    Is there any way, I can create all the views without error ? Some times the underlying tables may not be existing while creating views.

    Thank you for your help.

  • Ummmm.... so what do you want to do if the underlying tables don't exist?

    --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)

  • thank you for your reply jeff. underlying tables will be created later. Actually underlying tables is not my major problem. I can create all tables before executing views script. At present we are using SQLCompare to create views and its creating all views without errors. So there must be some way we can create all the views without refering to underlying views. OR is SQLCompare identifying the base views and creating them first to supress errors ? In future we dont want to use SQLCompare.

  • SQL Compare does something in the background to check dependencies. You could probably do something similar but, I have to ask, why don't you want to use SQL Compare to do this? It's easy, accurate, and already paid for.

    --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)

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

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