Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-06-03 : 08:20:02
|
| Antonio Bandeira writes "Hi!i´m writting you one more time because i´ve foud an Error in clause between.see my exemple:i write this commmand in Query Analizer:select * from VCL_AGENDA where Placa_Veiculo='KKJ3193 ' and (cast('27/05/2004' as datetime) between Dt_Saida and Dt_Retorno)so look what it´s came:Placa_Veiculo Dt_Saida Dt_Retorno KKJ3193 2004-05-24 00:00:00.000 2005-05-24 00:00:00.000how can it´s possible?when 05/27/2004 is between 05/24/2004am i writing any thing wrong?is there any other type to do this?and there more!!some times when a uses between clauses i need to add one day to the param date because it´s depends of my param date.let me explain better:i´ve this command (exemple):select * from Tb_Rat where (Dt_Rat between '21/04/2004' and '20/05/2004') and nu_rat = '12345'some times it´s take to me all dates beginning in 21/04/2004 and finishing in 20/05/2004others time, it´s don´t take me dates that are in 20/05/2004.mut if i look inside mu table the data are there.i don´t know what it is? i think that it because the time but i´m not sure.if it is, how can i eliminate the time from a field datetime im my query?Please, help me with this cause i don´t know what to do any more and it´s a serios problem!!Sorry about my English!!!i´m from Brasil and all i know about english i learn by my self and i don´t pratic.Tahnk so much!!Antonio Kuroki Bandeira." |
|
|
kroky
Starting Member
14 Posts |
Posted - 2004-06-03 : 09:49:50
|
| Try to type the dates in the 'yyyy/mm/dd' format if this doesent solve your problem give more information about your tables.and be sure the SQL server doesent do diffrent things when you run one query twice.and also when you dont type the time by default 00:00:00.000 is taken so dont worry about skiping the time when you manually type dates. |
 |
|
|
|
|
|