在我下面的查询中(情节日期101),它显示日期为04022018,但我希望它显示为04/02/2018,但它对我不起作用..请重写以帮助我整个查询在这里...
prdt1 = isnull((select replace(convert(char(10),EpisodeDate,101),'/','')
from AbsAcct_Episodes(nolock) where VisitID = HimVisit.VisitID
and EpisodeUrnID=1),'')
感谢大家的帮助。
答案 0 :(得分:0)
我怀疑不需要replace()
,可以将convert()
与样式代码101
一起使用:
select convert(char(10),EpisodeDate,101)
from AbsAcct_Episodes
where VisitID = HimVisit.VisitID and
EpisodeUrnID = 1;
答案 1 :(得分:0)
SELECT CONVERT (VARCHAR (20), EpisodeDate, 101) AS NewDate
FROM bsAcct_Episodes WITH (NOLOCK)
WHERE VisitID = HimVisit.VisitID
AND EpisodeUrnID = 1;