diff --git a/lib/active_record/connection_adapters/sqlserver/database_statements.rb b/lib/active_record/connection_adapters/sqlserver/database_statements.rb index 0473afb8e..741b10ccd 100644 --- a/lib/active_record/connection_adapters/sqlserver/database_statements.rb +++ b/lib/active_record/connection_adapters/sqlserver/database_statements.rb @@ -210,7 +210,7 @@ def execute_procedure(proc_name, *variables) with_raw_connection do |conn| result = internal_raw_execute(sql, conn) verified! - options = { as: :hash, cache_rows: true, timezone: ActiveRecord.default_timezone || :utc } + options = { as: :hash, cache_rows: true, timezone: @config[:default_timezone]&.to_sym || ActiveRecord.default_timezone || :utc } result.each(options) do |row| r = row.with_indifferent_access @@ -473,7 +473,7 @@ def _raw_select(sql, conn) def handle_to_names_and_values(handle, options = {}) query_options = {}.tap do |qo| - qo[:timezone] = ActiveRecord.default_timezone || :utc + qo[:timezone] = @config[:default_timezone]&.to_sym || ActiveRecord.default_timezone || :utc qo[:as] = (options[:ar_result] || options[:fetch] == :rows) ? :array : :hash end results = handle.each(query_options)