From 0b828b101817d385bd3546ef7ab93d7dba50a93e Mon Sep 17 00:00:00 2001 From: Lucas Ortiz Date: Mon, 21 Aug 2023 19:33:12 +0200 Subject: [PATCH] fix calc_batch_size #407 --- .../sqlserver/macros/materializations/seeds/helpers.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbt/include/sqlserver/macros/materializations/seeds/helpers.sql b/dbt/include/sqlserver/macros/materializations/seeds/helpers.sql index f1597227..34c8e726 100644 --- a/dbt/include/sqlserver/macros/materializations/seeds/helpers.sql +++ b/dbt/include/sqlserver/macros/materializations/seeds/helpers.sql @@ -8,12 +8,12 @@ {% macro calc_batch_size(num_columns) %} {# - SQL Server allows for a max of 2100 parameters in a single statement. + SQL Server allows for a max of 2098 parameters in a single statement. Check if the max_batch_size fits with the number of columns, otherwise reduce the batch size so it fits. #} {% set max_batch_size = get_batch_size() %} - {% set calculated_batch = (2100 / num_columns)|int %} + {% set calculated_batch = (2098 / num_columns)|int %} {% set batch_size = [max_batch_size, calculated_batch] | min %} {{ return(batch_size) }}