Good afternoon im new a sql server and i tried to count the records for a derired day but it extracts the same name of records for any day
the FEC_SALDO is smalldatetime 4 and the format is like this
Fec_saldo 2012-07-12 00:00:00 2012-07-12 00:00:00 this is the query:
select FEC_SALDO, count(*) from SALDOS_PREPAGO_DIARIOS_ALTAMIRA_SALDOS where FEC_SALDO >= '20120701' and FEC_SALDO <= '201207004' group by FEC_SALDO
it prints out 100 rows but if i chenged the where clausethe date for example
where FEC_SALDO >= '20120703' and FEC_SALDO <= '201207004'
it yields me the same number of records
i dont know if it has something to do with the date format
thanks in advanced
Your date format for the <= condition does not seem right. Should it be '20120704' instead of '201207004'?
You are seeing the same results probably because there is no data that gets excluded when you narrow the range. Change your where clause as shown below and see if you get any rows at all. If the count shows up as zero, then you know.
where FEC_SALDO >= '20120701'
and FEC_SALDO < '20120703'
yes you are right, but mistakenly i typed the '201207004', but actually i typed the right one as you suggested and run the query but it yielded me the same amount of records, abd it should bring me fewer records. Thanks again in advanced