{"record":{"id":"cce2f2ae41458b37","repo":"risingwavelabs/risingwave","slug":"too-many-column","errorCode":null,"errorMessage":"too many column {}","messagePattern":"too many column (.+?)","errorType":"validation","errorClass":"SinkError::SqlServer","httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/sqlserver.rs","lineNumber":148,"sourceCode":"    }\n}\nimpl SqlServerSink {\n    pub fn new(\n        mut config: SqlServerConfig,\n        schema: Schema,\n        pk_indices: Vec<usize>,\n        is_append_only: bool,\n    ) -> Result<Self> {\n        // Rewrite config because tiberius allows a maximum of 2100 params in one query request.\n        const TIBERIUS_PARAM_MAX: usize = 2000;\n        let params_per_op = schema.fields().len();\n        let tiberius_max_batch_rows = if params_per_op == 0 {\n            config.max_batch_rows\n        } else {\n            ((TIBERIUS_PARAM_MAX as f64 / params_per_op as f64).floor()) as usize\n        };\n        if tiberius_max_batch_rows == 0 {\n            return Err(SinkError::SqlServer(anyhow!(format!(\n                \"too many column {}\",\n                params_per_op\n            ))));\n        }\n        config.max_batch_rows = std::cmp::min(config.max_batch_rows, tiberius_max_batch_rows);\n        Ok(Self {\n            config,\n            schema,\n            pk_indices,\n            is_append_only,\n        })\n    }\n}\n\nimpl TryFrom<SinkParam> for SqlServerSink {\n    type Error = SinkError;\n\n    fn try_from(param: SinkParam) -> std::result::Result<Self, Self::Error> {","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/sqlserver.rs#L130-L166","documentation":"SQL Server writes via Tiberius are limited to TIBERIUS_PARAM_MAX parameters per operation; each row consumes params_per_op parameters. If even one row would exceed that limit (so the computed batch size floors to 0), the sink cannot proceed and raises this SqlServer error.","triggerScenarios":"Calling SqlServerSink::new (via SinkWriterV1Adapter / sink creation) for a table whose column count is so large that params_per_op >= TIBERIUS_PARAM_MAX, making tiberius_max_batch_rows == 0.","commonSituations":"Very wide tables (hundreds of columns) being sunk to SQL Server; each column needs multiple params (e.g. INSERT plus upsert MERGE params) blowing past the ~2100 TDS parameter limit.","solutions":["Reduce the number of columns sunk (drop or combine columns, e.g. serialize struct columns to a single string)","Sink into multiple narrower SQL Server tables","Increase TIBERIUS_PARAM_MAX handling by lowering params_per_op (not possible without code change) — or split the sink"],"exampleFix":"// before\nCREATE SINK s INTO sqlserver ... AS SELECT * FROM wide_mv; -- 700 columns\n// after\nCREATE SINK s INTO sqlserver ... AS SELECT id, a, b, c FROM wide_mv; -- narrow projection","handlingStrategy":"validation","validationCode":"const TIBERIUS_PARAM_MAX: usize = 2100;\nfn check_width(num_columns: usize, params_per_column: usize) -> Result<(), String> {\n    let params_per_op = num_columns * params_per_column;\n    if params_per_op == 0 || params_per_op >= TIBERIUS_PARAM_MAX {\n        Err(format!(\"{} cols * {} params too wide for SQL Server (max {} params)\", num_columns, params_per_column, TIBERIUS_PARAM_MAX))\n    } else { Ok(()) }\n}","typeGuard":null,"tryCatchPattern":"match create_sqlserver_sink(cfg) {\n    Err(e) if e.to_string().contains(\"too many column\") => split_sink_into_narrower_tables(),\n    other => other,\n}","preventionTips":["Keep sunk table column counts modest (well under ~500)","Prefer serializing nested/struct columns to one string column","Estimate params-per-row (insert + upsert params) before creating wide sinks"],"tags":["sqlserver","sink","limit","wide-table"],"backgroundTag":"value-out-of-range","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}