如何在 SQL Server 中列出可用的强制转换?

Eva*_*oll 4 sql-server type-conversion cast

在 PostgreSQL 中,有一个命令,\dC+我可以在 psql 中使用\dC+

\dC[+]  [PATTERN]      list casts
Run Code Online (Sandbox Code Playgroud)

列出可能的CASTS. 这是有用的,因为我可以很容易地找出哪些我可以用它来投地timestamp

\dC+ timestamp
                                             List of casts
         Source type         |         Target type         |  Function   |   Implicit?   | Description 
-----------------------------+-----------------------------+-------------+---------------+-------------
 abstime                     | timestamp without time zone | timestamp   | yes           | 
 date                        | timestamp without time zone | timestamp   | yes           | 
 timestamp without time zone | abstime                     | abstime     | in assignment | 
 timestamp without time zone | date                        | date        | in assignment | 
 timestamp without time zone | timestamp without time zone | timestamp   | yes           | 
 timestamp without time zone | timestamp with time zone    | timestamptz | yes           | 
 timestamp without time zone | time without time zone      | time        | in assignment | 
 timestamp with time zone    | timestamp without time zone | timestamp   | in assignment | 
Run Code Online (Sandbox Code Playgroud)

SQL Server 中是否有类似的命令?我怎样才能找到我能做 CAST的事DateTime2?这在任何地方都有记录吗?

Han*_*non 6

CAST 和 CONVERTMicrosoft Docs 页面提供了一个很好的 SQL Server 转换矩阵。

上面页面中包含的图像:

在此处输入图片说明

据我所知,没有显示有效强制转换列表的内置机制。