• Hiyas.

    Had the same problem with the quotes ... noticed in QA that everything was red so I added a fifth quote.

    Anyway. Got a small addition here for the same sproc USP_DBshowcontig_single_db :

    set @sql = 'SELECT TABLE_NAME = ' + @dbname + '..SYSUSERS.NAME' + ' + ''.'' + ' + '' + @dbname + '..SYSOBJECTS.NAME FROM ' + @dbname + '..SYSOBJECTS JOIN ' + @dbname + '..SYSUSERS ON ' + @dbname + '..SYSOBJECTS.uid = ' + @dbname + '..SYSUSERS.uid WHERE XTYPE =' + '''' + 'U' + ''''

    It adds the owner name of the table to TABLE_NAME, which allows you to run the script on databases which have user tables not created by sa.

    My piece replaces the line:

    set @sql = 'SELECT TABLE_NAME = NAME FROM ' + @dbname + '..SYSOBJECTS WHERE XTYPE =' + '''' + 'U' + ''''

    Good luck.

     

    hot2use


    __________________________________
    Searching the KB articles is like
    picking your nose. You never know
    what you'll find.