Microsoft KB Archive/258983

= Date Values in Database Crawls Are Not Preserved Correctly =

Article ID: 258983

Article Last Modified on 10/30/2003

-

APPLIES TO


 * Microsoft Site Server 3.0 Standard Edition

-



This article was previously published under Q258983



SYMPTOMS
When you are crawling a database with Site Server Search, you may notice that date fields are not retrievable or searchable. You may also get an error message reporting that the query is too complex if you search on one of the date fields.



CAUSE
Search expects a very specific format for date values but the OLE DB provider may not return the data in this format. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

240390 Custom Date Properties Are Set to Null Value



RESOLUTION
To resolve this problem, you must modify the Row.asp page that the Search Catalog Wizard created for this database crawl project. Here is a sample modification.

Note UID should correspond to a User account that has appropriate permissions on the database. <% Set r = createobject (&quot;ADODB.Recordset.1.5&quot;) %> <% r.Open &quot;SELECT LastModified, DocumentID, Title, Author, Body FROM Documents WHERE DocumentID = &quot; & Request.QueryString(&quot;id&quot;), &quot;UID= ;PWD= ;DSN=News&quot; %> <% Dim x %> <% ReDim x(5) %> <% x(0) = r (&quot;LastModified&quot;) %> <% x(1) = r (&quot;DocumentID&quot;) %> <% x(2) = r (&quot;Title&quot;) %> <% x(3) = r (&quot;Author&quot;) %> <% x(4) = r (&quot;Body&quot;) %>  <% Function Format_DBTYPE_DATETIME(value) If IsEmpty(value) OR IsNULL(Value) Then Format_DBTYPE_DATETIME = value Else fDAY = day(value) fMONTH = month(value) fYEAR = year(value) fHOUR = hour(value) fMINUTE = minute(value) fSECOND = second(value)

select case (fMONTH) case 1 fMONTHSTR = &quot;Jan&quot; case 2 fMONTHSTR = &quot;Feb&quot; case 3 fMONTHSTR = &quot;Mar&quot; case 4 fMONTHSTR = &quot;Apr&quot; case 5 fMONTHSTR = &quot;May&quot; case 6 fMONTHSTR = &quot;Jun&quot; case 7 fMONTHSTR = &quot;Jul&quot; case 8 fMONTHSTR = &quot;Aug&quot; case 9 fMONTHSTR = &quot;Sep&quot; case 10 fMONTHSTR = &quot;Oct&quot; case 11 fMONTHSTR = &quot;Nov&quot; case 12 fMONTHSTR = &quot;Dec&quot; end select

fDATE = fDAY & &quot; &quot; & fMONTHSTR & &quot; &quot; & fYEAR fTIME = fHOUR & &quot;:&quot; & fMINUTE & &quot;:&quot; & fSECOND fDATETIME = fDATE & &quot; &quot; & fTIME Format_DBTYPE_DATETIME = fDATETIME End if End Function %>

<% y=VarType(x(2)) %> <% if y <> 0 And y <> 1 Then %> <% =server.htmlencode (x(2)) %> <% End if %>  <% y=VarType(x(0)) %> <% if y <> 0 And y <> 1 Then %> &quot;> <% End if %> <% y=VarType(x(1)) %> <% if y <> 0 And y <> 1 Then %> &quot;> <% End if %> <% y=VarType(x(3)) %> <% if y <> 0 And y <> 1 Then %> &quot;> <% End if %>  <% y=VarType(x(4)) %> <% if y <> 0 And y <> 1 Then %> <% =server.htmlencode (x(4)) %> <% End if %> 

Keywords: kbprb KB258983

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.