microsoft / microsoft/go-sqlcmd

Investigate ODBC compatibility mode via environment variable

Open
#660 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
595
Forks
91
Avg merge
9h 35m
Merged PRs (30d)
1

Description

Summary

Investigate adding an environment variable (e.g., SQLCMD_ODBC_COMPAT=1) that would make go-sqlcmd behave exactly like the original ODBC sqlcmd for maximum backward compatibility.

Motivation

go-sqlcmd has intentionally diverged from ODBC sqlcmd in several areas to provide better defaults for modern usage. However, users migrating existing scripts or workflows may need exact behavioral compatibility with the original tool.

Potential Scope

When the compatibility mode is enabled, go-sqlcmd would match ODBC sqlcmd behavior in areas including:

Codepage Handling (PR #638)
Behavior go-sqlcmd (current) ODBC sqlcmd Compat mode
Default encoding UTF-8 Windows ANSI (system locale) ANSI
UTF-16 codepages (1200, 1201) Not supported Supported Supported
BOM detection Automatic Automatic Automatic
Other Potential Areas (to investigate)
  • Output formatting differences
  • Error message formatting
  • Exit code behavior
  • Variable expansion edge cases
  • Null handling in output
  • Column width calculations

Implementation Options

  1. Single env var: SQLCMD_ODBC_COMPAT=1 enables all compatibility behaviors
  2. Granular env vars: SQLCMD_CODEPAGE_COMPAT=1, SQLCMD_OUTPUT_COMPAT=1, etc.
  3. Command-line flag: --odbc-compat or -y (if available)

Tasks

  • Document all known behavioral differences between go-sqlcmd and ODBC sqlcmd
  • Evaluate which differences can reasonably be made configurable
  • Design the compatibility mode API (env var name, granularity)
  • Implement compatibility mode for codepage handling
  • Add tests for compatibility mode behavior
  • Update documentation

Related

  • PR #638: Add -f codepage flag for input/output encoding
  • This issue originated from codepage investigation showing ODBC uses ANSI default vs go-sqlcmd's UTF-8 default

Labels

enhancement, documentation

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing PR #638 and the listed differences between go-sqlcmd and ODBC sqlcmd. Compare codepage handling, output, errors, exit codes, variable expansion, nulls, and column widths, then determine which behaviors can be configured. Done requires a documented compatibility design, implementation scope, tests, and documentation updates.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.