Click here to Skip to main content
15,909,741 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralGetSafeHwnd() Pin
ns5-Nov-02 4:53
ns5-Nov-02 4:53 
GeneralRe: GetSafeHwnd() Pin
TyMatthews5-Nov-02 6:14
TyMatthews5-Nov-02 6:14 
GeneralRe: GetSafeHwnd() Pin
ns5-Nov-02 6:17
ns5-Nov-02 6:17 
GeneralRe: GetSafeHwnd() Pin
Ravi Bhavnani5-Nov-02 7:32
professionalRavi Bhavnani5-Nov-02 7:32 
GeneralRe: GetSafeHwnd() Pin
ns5-Nov-02 7:36
ns5-Nov-02 7:36 
GeneralRe: GetSafeHwnd() Pin
Ravi Bhavnani5-Nov-02 7:57
professionalRavi Bhavnani5-Nov-02 7:57 
GeneralSQL Wildcard Search Pin
Richard Hudson5-Nov-02 4:47
Richard Hudson5-Nov-02 4:47 
GeneralRe: SQL Wildcard Search Pin
Pete Bassett5-Nov-02 5:48
Pete Bassett5-Nov-02 5:48 
Hi. Well, I've made a few assumptions in my answer.

1) you're running SQL server
2) You're trying to run a Like against your Date field.
3) Your date field is of type DateTime

Well, the docuementation for Like says

Syntax
match_expression [ NOT ] LIKE pattern [ ESCAPE escape_character ] 

Arguments
match_expression

Is any valid SQL Server expression of character string data type.
...


So, the date needs to be converted to a string before you run the like on it. You can use the CONVERT function to do that.

E.g.
--CONVERT ( data_type [ ( length ) ] , expression [ , style ] )
select CONVERT(varchar, DateField, 103 ), DateField From SourceTable


The 103 you see there is the style or datetime you want to convert to. E.g.

From MSDN

0 or 100 Default mon dd yyyy hh:miAM (or PM) 
1 or 101 USA mm/dd/yy 
2 or 102 ANSI yy.mm.dd 
3 or 103 British/French dd/mm/yy 
4 or 104 German dd.mm.yy 
5 or 105 Italian dd-mm-yy 
6 or 106 - dd mon yy 
7 or 107 - Mon dd, yy 
8 or 108 - hh:mm:ss 
9 or 109 (*)  Default + milliseconds mon dd yyyy hh:mi:ss:mmmAM (or PM) 
10 or 110 USA mm-dd-yy 
11 or 111 JAPAN yy/mm/dd 
12 or 112 ISO yymmdd 
13 or 113 (*)  Europe default + milliseconds dd mon yyyy hh:mm:ss:mmm(24h) 
14 or 114 - hh:mi:ss:mmm(24h) 
20 or 120 (*)  ODBC canonical yyyy-mm-dd hh:mi:ss(24h) 
21 or 121 (*)  ODBC canonical (with milliseconds) yyyy-mm-dd hh:mi:ss.mmm(24h) 
126(***) ISO8601 yyyy-mm-dd Thh:mm:ss:mmm(no spaces) 
130* Kuwaiti dd mon yyyy hh:mi:ss:mmmAM 
131* Kuwaiti dd/mm/yy hh:mi:ss:mmmAM 

*    The default values (style 0 or 100, 9 or 109, 13 or 113, 20 or 120, and 21 or 121) always return the century (yyyy).
** Input when converting to datetime; output when converting to character data.
*** Designed for XML use. For conversion from datetime or smalldatetime to character data, the output format is as described in the table. For conversion from float, money, or smallmoney to character data, the output is equivalent to style 2. For conversion from real to character data, the output is equivalent to style 1.


I suggest using 121 "yyyy-mm-dd hh:mi:ss.mmm" as you can get everything back.

Then run like as you want.

E.g.
select DateFieldFrom SourceTable
Where CONVERT ( varchar , DateField, 121 ) like '2002-11-05 [0-1][0-4]%'


I hope this solves you problem.


Pete

Insert Sig. Here!
GeneralRe: SQL Wildcard Search Pin
Jon Hulatt5-Nov-02 5:43
Jon Hulatt5-Nov-02 5:43 
GeneralRe: SQL Wildcard Search Pin
Member 15922365-Nov-02 7:53
Member 15922365-Nov-02 7:53 
GeneralRegarding bsc files Pin
cutti5-Nov-02 4:09
cutti5-Nov-02 4:09 
GeneralSockets through Proxy Pin
Pete Bassett5-Nov-02 3:44
Pete Bassett5-Nov-02 3:44 
GeneralRe: Sockets through Proxy Pin
Daniel Turini5-Nov-02 5:03
Daniel Turini5-Nov-02 5:03 
GeneralRe: Sockets through Proxy Pin
Pete Bassett5-Nov-02 5:28
Pete Bassett5-Nov-02 5:28 
GeneralPrinting a dialog box Pin
Brad West5-Nov-02 3:03
Brad West5-Nov-02 3:03 
GeneralRe: Printing a dialog box Pin
dabs5-Nov-02 3:12
dabs5-Nov-02 3:12 
GeneralRe: Printing a dialog box Pin
includeh105-Nov-02 4:55
includeh105-Nov-02 4:55 
GeneralRe: Printing a dialog box Pin
Mazdak5-Nov-02 5:09
Mazdak5-Nov-02 5:09 
GeneralPrinting a dialog box Pin
Anonymous5-Nov-02 3:03
Anonymous5-Nov-02 3:03 
GeneralRe: Printing a dialog box Pin
includeh105-Nov-02 5:07
includeh105-Nov-02 5:07 
GeneralDefault font static control Pin
Wim Jans5-Nov-02 2:25
Wim Jans5-Nov-02 2:25 
GeneralRe: Default font static control Pin
dabs5-Nov-02 2:57
dabs5-Nov-02 2:57 
Generaltwo puzzling questions about MDI app Pin
ns5-Nov-02 2:24
ns5-Nov-02 2:24 
GeneralRe: two puzzling questions about MDI app Pin
Andreas Saurwein5-Nov-02 3:20
Andreas Saurwein5-Nov-02 3:20 
GeneralRe: two puzzling questions about MDI app Pin
ns5-Nov-02 3:32
ns5-Nov-02 3:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.