Using the escape clause  Chapter 5: Reserved Words

Chapter 4: Expressions, Identifiers, and Wildcard Characters

Using wildcard characters with datetime data

When you use like with datetime values, Adaptive Server converts the dates to the standard datetime format, then to varchar. Since the standard storage format does not include seconds or milliseconds, you cannot search for seconds or milliseconds with like and a pattern.

It is a good idea to use like when you search for datetime values, since datetime entries may contain a variety of date parts. For example, if you insert the value “9:20” and the current date into a column named arrival_time, the clause:

where arrival_time = '9:20'

would not find the value, because Adaptive Server converts the entry into “Jan 1 1900 9:20AM.” However, the following clause would find this value:

where arrival_time like '%9:20%'




Copyright © 2005. Sybase Inc. All rights reserved. Chapter 5: Reserved Words

View this book as PDF