Following query could be used to show definitions of custom table.
SELECT ORDINAL_POSITION, COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH
, IS_NULLABLE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'PostHistory'
not work for sys tables
SELECT ORDINAL_POSITION, COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH
, IS_NULLABLE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'sys.time_zone_info'
I guess the info is in another table in another database what are they?
I've also tried sp_help 'sys.time_zone_info'
, and got
The EXECUTE permission was denied on the object 'sp_help', database 'mssqlsystemresource', schema 'sys'.
Best Answer
sys.time_zone_info
is a system view with the definition:The
OPENROWSET
call is a wrapper over an internal structure. You cannot get information about it directly.The columns returned by the view are shown in the documentation
and from nchar and nvarchar (Transact-SQL):
You can also obtain the information you want from the system catalogue views, for example:
db<>fiddle demo