Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Date Filed Query

$
0
0

Hi,

I have a database view which as a field : SentDate . In the view this field concatenates two fields from the base tables :

DATEADD(D, 0, DATEDIFF(D, 0, d.actualdate))+d5.TimeFull


actualdate is a datefield with values like : 2014-01-22 00:00:00.000 and timefull field has values like : 00:16:33


When I try to run filter on this concatenated field which is a varchar it throws error :

where CONVERT(VARCHAR(20),DATEADD(D, 0, DATEDIFF(D, 0, d.actualdate))+d5.TimeFull,120)   >='12/16/2013'

or 

 CONVERT(datetime,DATEADD(D, 0, DATEDIFF(D, 0, d.actualdate))+d5.TimeFull)   >='2013-12-16'

Msg 241, Level 16, State 1, Line 3
Conversion failed when converting date and/or time from character string.

Please guide as to how can I use this field to apply date filters in my where clause.

Thanks


EVA05


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>