-1

我对 T-SQL 很陌生。实际上可以更改由 JOIN 语句返回的值吗?例如,我有一个带有列的表float。它返回一个 JOIN。但我想将此列转换为varchar.

4

2 回答 2

0

当然。只需在您的SELECT查询中转换它:

SELECT
CONVERT(VARCHAR(20), table2.field) AS field
FROM table1
JOIN table2 on ...

或者STR,如果您想指定长度和精度,请使用:

SELECT
STR(table2.field, 10, 2) AS field
FROM table1
JOIN table2 on ...
于 2013-11-05T16:52:07.073 回答
0

CAST()是另一种选择。

SELECT
    CAST(B.returned_value as varchar(40)) [returned_value]
FROM
    TableA A
    INNER JOIN TableB B ON A.id = B.fk_id
于 2013-11-05T16:53:55.977 回答