• smcguire (4/10/2013)


    I recently discovered the original stored procedure that you referenced. The one issue that I have with it is the limitation that it runs on ALL databases! There is no way to limit the list of databases it runs on. I would like to see an additional parameter (such as @LimitDB) which would contain a like clause that would be used when querying for the list of databases (if not specified then all databases would be selected).

    --Stewart McGuire

    You can take what was posted and add like below (as an example)

    INSERT INTO @dbs

    select name as DBName, ROW_NUMBER() OVER(PARTITION BY 1 ORDER BY name) AS DBNumber

    from sys.databases

    AND name like @LimitDB