You are here: Re: Convert Sting to Date « MsSQL Server « IT news, forums, messages
Re: Convert Sting to Date

Posted by Erland Sommarskog on 03/02/06 10:14

Crumb (rowan.ian@gmail.com) writes:
> Many Thanks for the reply, I am one step nearer as this now runs
> without errors:)
>
> What I am trying to do is as follows:
>
> I have a table that contains all the phone calls in and out, (Called
> and Destination numbers). I am trying to create a asp page that will
> search the db for a telephone number (MMColParam) in either called or
> destinaition fields but only between two dates (MMColParam1 and 2)
>
> The information you gave me helped me return a result but it returns
> all calls and not just the ones between the dates specified.

Yes, I made a remark on this flaw, but I could not be sure what you wanted.

AND binds harder than OR, so you must use parentheses:

WHERE (OriginationNumber Like @MMColParam or
DestinationNumber Like @MMColParam) and
StartTime Between @MMColParam2 AND @MMColParam3

Else you get all rows with a matching Originationumber, no matter
the start time.

Think of OR as + and AND as *.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация