create table in mutiple schemas

  • hi,

    i need to create single table in nearly 50 schemas.
    can anyone provide automation script for this

  • Arjun SreeVastsva - Wednesday, October 25, 2017 8:06 PM

    hi,

    i need to create single table in nearly 50 schemas.
    can anyone provide automation script for this

    Use Excel formulas ... simple.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Something like this will generate all the create statements...

    SELECT 'CREATE TABLE ['+name+'].[YourTable]
        (
            ID INT
        )
    GO'
    FROM sys.schemas where principal_id = 1

    Then you'd just need to copy/paste/execute

Viewing 3 posts - 1 through 2 (of 2 total)

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