Repository navigation
Conversation
Format DATE values without converting them to SqlDateTime. Keep regression coverage focused on CLR TableToString, where the overflow occurred.
masmgr
marked this pull request as draft
October 18, 2026 06:32
Run LocalBuild.ps1 and LocalValidate.ps1 against SQL Server 2017, 2019 and 2022 service containers, mirroring the dev container setup with a throwaway self-signed signing key. Test results are summarized on the run page and uploaded as artifacts. Remove build_and_test_on_spawn.yml, which depended on the discontinued Spawn service and on ant build files that no longer exist.
Add GitHub Actions CI for build and validation on SQL Server (Linux)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #43.
tSQLt.TableToTextis now implemented in T-SQL, so the public API already handles pre-1753DATEvalues on the base branch. The CLRTableToStringimplementation is no longer called by tSQLt itself and is only reachable through a direct call to the internaltSQLt.Private::TableToString, so the user-facing impact of this change is minimal. This PR fixes the remaining overflow there for consistency.Problem
Formatting a
DATEbefore1753-01-01through CLRTableToStringthrowsSqlDateTime overflow: theDateTimereturned bySqlDataReader.GetDateTimewas implicitly converted toSqlDateTime, whose range is narrower thanDATE.Change
SqlDateToStringnow takesDateTimeand formats it withCultureInfo.InvariantCulture, so the fullDATErange comes out as Gregorianyyyy-MM-dd. The other date/time helpers and method names are unchanged.TableToStringcovering0001-01-01,1752-12-31,1753-01-01,9999-12-31, andNULL.Validation
SqlDateTime overflow. With this change, all 43TableToTextTestspass (SET LANGUAGE us_english, because one existing test expects an English error message).dotnet build(unsigned) passes with 0 warnings and 0 errors.SqlDateToStringreturns the expected output for the four boundary dates underen-US,ar-SA, andth-TH.Not tested: SQL Server 2017, non-Gregorian cultures inside SQL Server, the full integration suite.