Home Forums SQL Server 2005 Administering Replacing Schema with new schema of Database objects RE: Replacing Schema with new schema of Database objects

  • Hi,

    Try this:

    set the o/p mode to text in SSMS .. then run the following .....

    SELECT 'ALTER SCHEMA Employee TRANSFER ' + TABLE_SCHEMA + '.' + TABLE_NAME

    FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'EMP'

    sp_msforeachtable

    this is an undocumented procedure ... it is very handy but not recommended by Microsoft.

    Also old schema "Emp" is used in my stored procedure and views with tables. I also wants to replace in those stored proc and views.Is there any good script/tool is available for this.

    I would go with what Jack suggested ....

    I would script out all my procedures, functions, and views and then do a search and replace to change Emp. to Employee.

    Hope this helps ... 🙂

    Happy 4th of JULY !

    Thanks,

    \\K

    ______________________________________________________________________________________________________________________________________________________________________________________
    HTH !
    Kin
    MCTS : 2005, 2008
    Active SQL Server Community Contributor 🙂