если у меня DateStart = 2012-03-19 00: 00: 00.000 и DateEnd 2012-03-24 23: 59: 59.000, тогда я пытаюсь
SELECT EventGuid,
Title,
DESCRIPTION,
CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, DateStart))) AS
DateStart,
CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, DateEnd))) + '23:59:59' AS DateEnd
,
Address1,
Address2,
City,
PostalCode,
Country,
Latitude,
Longitude,
SeatCount,
SeatCost,
Active,
DateCreated,
DATEPART(HH, DateStart) AS
StartHour,
LastModified
FROM Event
WHERE ( Active = 1 )
AND ( EventTypeGuid <> '00000000-0000-0000-0000-000000000000' )
AND ( CONVERT(DATETIME, '3/19/2012') <= DateEnd )
AND ( CONVERT(DATETIME, '3/19/2012') >= DateStart )
ORDER BY DateStart
Он не поднимает строку.
Если я изменяю на Between syntaxt
SELECT EventGuid,
Title,
DESCRIPTION,
CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, DateStart))) AS
DateStart,
CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, DateEnd))) + '23:59:59' AS DateEnd
,
Address1,
Address2,
City,
PostalCode,
Country,
Latitude,
Longitude,
SeatCount,
SeatCost,
Active,
DateCreated,
DATEPART(HH, DateStart) AS
StartHour,
LastModified
FROM Event
WHERE ( Active = 1 )
AND ( EventTypeGuid <> '00000000-0000-0000-0000-000000000000' )
AND ( CONVERT(DATETIME, '3/19/2012') BETWEEN DateStart AND DateEnd )
ORDER BY DateStart
Он также получает дату 3/19
Итак, я изменил SQl ниже, DateStart = 2012-06-03 23: 59: 51.000 DateStart2 (мне нужно отобразить его) 2012-06-04 00: 00: 00.000 и DateEnd 2012-06-09 23 : 59: 59.000 Но это не значит забрать дату 6/4 ...
SELECT EventGuid,
Title,
DESCRIPTION,
CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, DateStart))) - '00:00:09' AS
DateStart,
CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, DateStart))) AS
DateStart2,
CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, DateEnd))) + '23:59:59' AS
DateEnd,
Address1,
Address2,
City,
PostalCode,
Country,
Latitude,
Longitude,
SeatCount,
SeatCost,
Active,
DateCreated,
DATEPART(HH, DateStart) AS
StartHour,
LastModified
FROM Event
WHERE ( Active = 1 )
AND ( EventTypeGuid <> '00000000-0000-0000-0000-000000000000' )
AND ( CONVERT(DATETIME, '6/4/2012') BETWEEN DateStart AND DateEnd )
ORDER BY DateStart