Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select between
Message
De
25/07/2006 05:06:03
 
 
À
25/07/2006 04:55:12
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01139595
Message ID:
01139599
Vues:
12
This message has been marked as the solution to the initial question of the thread.
>I have a problem with select records from table.
>There are one record in table mydb.dbo.R_mytable with datetime field
>mydatetime={25.07.2006 12:27}
>
>But SQL-command:
>select * from mydb.dbo.R_mytable where mydatetime between
>convert(datetime,'05.07.2006',104) and convert(datetime,'25.07.2006',104)
>
>not find records.
>
>Please help.

This SELECT will not find any records, becuase you search for records between:

05.07.2006 00:00:00 and 25.07.2006 00:00:00

but your records are after 25.07.2006 00:00:00 -> 25.07.2006 12:27:00

If you don't want time portion to take a place in SELECRT change it to:
select *
       from mydb.dbo.R_mytable
       where convert(varchar(8),mydatetime,112) between '20060705' AND '20060725'
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform