我有一个查询,它将返回一组日期。我想将这些值括在'[]'中。
我的查询是
SELECT distinct convert(varchar, track_empHours_date, 103)
as track_empHours_date
FROM tbl_track_empHours
WHERE tbl_track_empHours.track_empHours_main_usr_id_fk = '268'
AND track_empHours_date BETWEEN '5/09/2011' AND '5/15/2011'
感谢任何帮助
答案 0 :(得分:2)
您也可以使用QUOTENAME
。
SELECT
DISTINCT QUOTENAME(CONVERT(VARCHAR, track_empHours_date, 103))
AS track_empHours_date ...
答案 1 :(得分:0)
SELECT distinct '[' + convert(varchar, track_empHours_date, 103) + ']'
as track_empHours_date
FROM tbl_track_empHours
WHERE tbl_track_empHours.track_empHours_main_usr_id_fk = '268'
AND track_empHours_date BETWEEN '5/09/2011' AND '5/15/2011'