Dump all Views of multiple databases in SQL Server I need to export the views from multiple databases of an older server. (Essentially, to generate a list of views using a particular piece of SQL Server)

The fastest way I've found thus far is to manually use the Generate scripts function to export the views to a file. 

I feel like there is probably a better way I don't know about. 

Thanks in advance,
You will certainly need the right permissions to view the views definition. This should work for you. Please note that I'm using the undocumented sp_MSforeachdb stored procedure. This means that it could change without notice so is not advisable to include as part of your production/live tsql code as it could fail. Check Aaron comment about it.

EXEC sp_MSforeachdb '
    IF DB_ID(''?'') &gt; 4
    BEGIN
        USE [?]
        SELECT DB_NAME()
        SELECT  c.text
            FROM    sysobjects o
                    JOIN syscomments c
                        ON c.id = o.id
            WHERE   o.type = ''V'';
    END'