Here, a cursor is used to loop through all databases.
Futhermore, a cursor from dynamic sql is used to query each database returned by the first cursor.
This is to demonstrate the connection-scope of a cursor.
DECLARE @db_name nvarchar(255)
DECLARE @sql nvarchar(MAX)
DECLARE @schema nvarcha...