Hi there,
I am having a few issues with the BETWEEN function in a query I am creating and I could use some help!
I am looking to search between a range of months. the data is presently expressed as 09/2014 (for September 2014) and so on, back to January 2001 (01/2001).
What I am trying to do is query a range of months BETWEEN 10/2013 and 09/2014, but when I do I either get too many results (including outside of my specified range) or no results (depending on which way around I specify my 2 dates).
The column is set to varchar so I have tried the following: -
- where cast(trans.TransactAcctMonth as datetime) between '01/10/2013' and '01/09/2014'
- where convert(varchar, trans.TransactAcctMonth, 106) between '01/10/2013' and '01/09/2014'
Using Cast returns: -
Msg 241, Level 16, State 1,
Line 1
Conversion failed when
converting date and/or time from...