PDW columns in sys.system_columns can break SELECTS using TRY...CATCH or XACT_ABORT
The following code...
BEGIN TRY
SELECT collation_name
FROM sys.system_columns
where object_id in (-593, -103085222)
END TRY
BEGIN CATCH
END CATCH
Returns
Msg 0, Level 11, State 0, Line 2
A severe error occurred on the current command. The results, if any, should be discarded.
Also an issue outside the TRY... CATCH
context if XACT_ABORT
is ON
Reported by someone here https://stackoverflow.com/q/60285080/73226

1 comment
-
Solomon Rutzky commented
Additional context:
The problem in its simplest form is with the following statement (taken from the column definition for "collation_name" as found via `EXEC sp_helptext N'sys.system_columns';` ):
```
SELECT COLUMNPROPERTYEX(-593, N'physical_name', 'collation');
```Please also see:
* Using metadata to troubleshoot metadata ( https://sqlblog.org/2019/12/18/metadata-meets-metadata )
* Msg 6522, Level 16 but no error message selecting from sys.all_columns ( https://stackoverflow.com/a/45764557/577765 )I suspect the issue is either a missing or incorrect collation_id value in the hidden [mssqlsystemresource] database for that particular column of those two specific objects (i.e. IDs -593 and -103085222).