File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
lib/active_record/connection_adapters/sqlserver Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -580,7 +580,8 @@ def view_information(table_name)
580580 @view_information ||= { }
581581 @view_information [ table_name ] ||= begin
582582 identifier = SQLServer ::Utils . extract_identifiers ( table_name )
583- view_info = select_one "SELECT * FROM INFORMATION_SCHEMA.VIEWS WITH (NOLOCK) WHERE TABLE_NAME = #{ quote ( identifier . object ) } " , "SCHEMA"
583+ information_query_table = identifier . database . present? ? "[#{ identifier . database } ].[INFORMATION_SCHEMA].[VIEWS]" : "[INFORMATION_SCHEMA].[VIEWS]"
584+ view_info = select_one "SELECT * FROM #{ information_query_table } WITH (NOLOCK) WHERE TABLE_NAME = #{ quote ( identifier . object ) } " , "SCHEMA"
584585 if view_info
585586 view_info = view_info . with_indifferent_access
586587 if view_info [ :VIEW_DEFINITION ] . blank? || view_info [ :VIEW_DEFINITION ] . length == 4000
You can’t perform that action at this time.
0 commit comments