July 16, 2003 at 1:44 pm
i wont to search between tow different date field in long date format !
and Boolean to find all the option !!
-------------
example
-----------
SELECT *
FROM dbo.notmdb
WHERE (unit IN (1)) AND (tarih >= '16/07/2003 16:00') AND (tarihb <= '17/07/2003 16:00') OR
(unit IN (1)) AND (tarih <= '16/07/2003 16:00') AND (tarihb >= '17/07/2003 16:00') OR
(unit IN (1)) AND (tarih >= '16/07/2003 16:00') AND (tarih <= '16/07/2003 16:00')
--------------------------------------
what i wont to do
is to create view
and put my format date like this
and search exact
and get the best date search result !!
-----------
1
dbo.mainb.tarih >= CONVERT(varchar, DATEADD([day], 0, GETDATE()), 112) + ' 16:00:00')
2
dbo.mainb.tarihb >= CONVERT(varchar, DATEADD([day], 1, GETDATE()), 112) + ' 16:00:00')
-------------------------
thnks
ilan
July 21, 2003 at 6:51 am
Do you mean like this
SELECT *,
(CASEWHEN (tarih >= CONVERT(varchar(11), DATEADD([day], 0, GETDATE()), 120)+'16:00:00')
AND (tarihb <= CONVERT(varchar(11), DATEADD([day], 1, GETDATE()), 120)+'16:00:00')
THEN 1
WHEN (tarih <= CONVERT(varchar(11), DATEADD([day], 0, GETDATE()), 120)+'16:00:00')
AND (tarihb >= CONVERT(varchar(11), DATEADD([day], 1, GETDATE()), 120)+'16:00:00')
THEN 2
WHEN (tarih >= CONVERT(varchar(11), DATEADD([day], 0, GETDATE()), 120)+'16:00:00')
AND (CONVERT(varchar(11), DATEADD([day], 0, GETDATE()), 120)+'16:00:00')
THEN 3
ELSE 0 END)
FROM dbo.notmdb
WHERE unit = 1
Far away is close at hand in the images of elsewhere.
Anon.
July 21, 2003 at 8:58 am
thnks but i get an error
-------------
Server: Msg 156, Level 15, State 1, Line 9
Incorrect syntax near the keyword 'THEN'.
-----------------------------------------
ilan
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply