Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select between
Message
 
To
25/07/2006 04:55:12
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01139595
Message ID:
01139599
Views:
11
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.
Previous
Reply
Map
View

Click here to load this message in the networking platform