Home Forums SQL Server 2005 Administering How to find out the Objects Defacults Schema Details RE: How to find out the Objects Defacults Schema Details

  • shine.mm (4/2/2008)


    Hi,

    What i would need is i would like to know each databases,Which are the Objects(Tables,Stored Procedures Etc.)not belong to the schema DBO.

    Fist i need to know which are the objects not belong to DBO

    Then i would like to change the schema of this objects to DBO

    Please help me

    Smm

    This query will give you objects in a single database that do not belong to dbo. I've also constructed the command you'd need to run to transfer the object to a different schema.

    select schema_name(schema_id), name, command = 'ALTER SCHEMA dbo TRANSFER [' + schema_name(schema_id) + '].[' + name + ']'

    from sys.objects

    where schema_name(schema_id) <> 'dbo'

    and type in('U','P','V', 'FN','TF','IF')