I suggest you ...

Expose Collation Info of SQL Server Result Set via SqlDataReader

The exact collation of each string field should be publicly available. The properties can be added to the DataTable returned by the GetSchemaTable() method, or they can be added as individual properties and/or methods of the SqlDataReader class, or a combination of both. The properties are:
1) LCID
2) SqlCompareOptions
3) collation_name (e.g. Latin1_General_100_BIN2)

The "LCID" and "SqlCompareOptions" values already exist in the "SqlDataReader" class, but are private or internal ( http://referencesource.microsoft.com/#System.Data/System/Data/SqlClient/SqlDataReader.cs,277 ). These would make sense to put into the GetSchemaTable output.

The "collation_name" value is necessary due to the combination of "LCID" and "SqlCompareOptions" not being enough to construct the source Collation. The issues are, at the very least, that the following two pieces of information are missing:
a) version info
b) BIN vs BIN2
Meaning, without getting the string "Latin1_General_100_BIN2" back for a column, even with LCID and SqlCompareOptions, there is no way to know if the source Collation was instead Latin1_General_BIN2, or Latin1_General_BIN, or Latin1_General_100_BIN.

6 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Solomon Rutzky shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    2 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base