0
SELECT 

incident.createDate,
LEFT(incident.createDate,11)as EntryDate,
ContactDetails.cityCode,
patient.insurance,

FROM ......

WHERE 
incident.createDate Between Convert(smalldatetime, '01/07/2012', 103) and Convert(smalldatetime, '31/12/2012', 103) 
and servicecharges.serviceid = 31 
and ServiceRequestDescription LIKE '05.06%'
and chargeDescr = 'Ε0 50.01'
and incident.status != 6
order by createDate ASC, contactdetails.cityCode ASC, patient.insurance ASC

作为输出我得到

15642     2012-08-03 11:45:07.153       Aug  3 2012         103      15

我想要得到的是

15642     2012-08-03      103        15

EntryDate 如上所述投射日期,所以我不想要它。下单也是错误的。它使用日期正确命令输出,但城市代码和保险不正确..

有任何想法吗?

4

2 回答 2

0

尝试这个

SELECT 
...
CONVERT(Varchar, incident.createDate, 103) as EntryDate,
ContactDetails.cityCode,
patient.insurance,

FROM ......
于 2013-02-28T08:57:07.667 回答
0

对于 Sql-Server:我认为没有直接的格式来获取. 您可以尝试然后得到如下。这里的小演示ONLY yyyy-mm-dd120/121left 10 characters

select left(convert(varchar,incident.createDate,120),10) as EntryDate
于 2013-02-28T09:09:05.103 回答