如何使用AS重命名此列以进行显示

时间:2019-06-02 06:49:18

标签: sql-server

我正在尝试将其重命名为DOC

Select Distinct 
    a.CID,
    CONCAT (RTRIM(Name1), ' ', RTRIM(Name2)) As [Name of Policy Holder],
    InsuStartDate = cast(InsuStartDate as date), --> DOC 

InsuStartDate重命名为DOC的可能方法是什么?

1 个答案:

答案 0 :(得分:1)

使用如下-

Select Distinct 
a.CID,
CONCAT (RTRIM(Name1), ' ', RTRIM(Name2)) As [Name of Policy Holder],
DOC = cast(InsuStartDate as date)

OR

Select Distinct 
a.CID,
CONCAT (RTRIM(Name1), ' ', RTRIM(Name2)) As [Name of Policy Holder],
cast(InsuStartDate as date) DOC