0
我是新來的SQL Server,我想我需要一點幫助。我想列標題中ItemDistributedStatus
重命名,AssignedTo
,AssignedDept
只是STATUS
,ASSIGNED TO
,DEPARTMENT
但AS 'column Name'
,因爲我認爲他們已經從CASE
查詢AS不承擔對他們的影響。如何更改SQL Server中的列名稱?
所以我只是不知道該怎麼做,已經嘗試用()封裝它,我只是得到錯誤。
這是我的查詢代碼。
SELECT
CASE
WHEN ItemDistributedStatus = 0
THEN 'Available'
WHEN ItemDistributedStatus = 1
THEN 'Assigned'
END AS ItemDistributedStatus,
SerialNum AS 'SERIAL',
ModelNum AS 'MODEL',
ItemType AS 'TYPE',
BrandManufacturer AS 'MANUFACTURER',
CASE
WHEN AssignedTo IS NULL
THEN '-'
ELSE AssignedTo
END AS AssignedTo,
CASE
WHEN AssignedDept IS NULL
THEN '-'
ELSE AssignedDept
END AS AssignedDept,
DateAssigned AS 'DATE'
FROM
TblItemDetails