<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7036.0">
<TITLE>RE: [HCN] Bluechip stored SQL dare format</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Thanks Peter! You definitely gave me enough to see the light. Thanks.</FONT>
<BR><FONT SIZE=2>Shaun</FONT>
</P>
<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: hcn-bounces@ozdocit.org [<A HREF="mailto:hcn-bounces@ozdocit.org">mailto:hcn-bounces@ozdocit.org</A>] On Behalf Of Peter Machell</FONT>
<BR><FONT SIZE=2>Sent: Thursday, 10 September 2009 5:18 PM</FONT>
<BR><FONT SIZE=2>To: Unmoderated discussion for HCN software, including Medical Director,Pracsoft and Bluechip</FONT>
<BR><FONT SIZE=2>Subject: Re: [HCN] Bluechip stored SQL dare format</FONT>
</P>
<P><FONT SIZE=2>On 10/09/2009, at 5:04 PM, Shaun Nell wrote:</FONT>
</P>
<P><FONT SIZE=2>> Hi,</FONT>
<BR><FONT SIZE=2>> A client as asked me check the possibility of writing some reports </FONT>
<BR><FONT SIZE=2>> using their Bluechip SQL database. It looks basic enough except </FONT>
<BR><FONT SIZE=2>> Bluechip stores the date as an int type rather than datetime. Does </FONT>
<BR><FONT SIZE=2>> anyone know how to convert this int to a proper date/time format? </FONT>
<BR><FONT SIZE=2>> At a guess I think it is the days since 0 AD.</FONT>
</P>
<BR>
<P><FONT SIZE=2>Sure do, assuming it's the same MSSQL datetime as Pracsoft:</FONT>
</P>
<P><FONT SIZE=2>"DECLARE @Date DATETIME; SET @Date = FLOOR(CONVERT(FLOAT, GETDATE()));</FONT>
<BR><FONT SIZE=2> SELECT APPT.[When] BETWEEN @Date </FONT>
<BR><FONT SIZE=2>AND (@DATE + x)"</FONT>
<BR><FONT SIZE=2> ORDER BY APPT.[When]"</FONT>
</P>
<BR>
<P><FONT SIZE=2>I think I've simplified that code enough for you to work out what is </FONT>
<BR><FONT SIZE=2>going on. Obviously @DATE is always now. The APPT.[When] brackets are </FONT>
<BR><FONT SIZE=2>because you really shouldn't use an SQL modifier as a table name, but </FONT>
<BR><FONT SIZE=2>someone over there didn't get that memo.</FONT>
</P>
<P><FONT SIZE=2>regards,</FONT>
<BR><FONT SIZE=2>Peter.</FONT>
</P>
<P><FONT SIZE=2>--</FONT>
<BR><FONT SIZE=2>Peter Machell</FONT>
<BR><FONT SIZE=2>Systems Administrator</FONT>
<BR><FONT SIZE=2>mobilecomputing.net.au</FONT>
<BR><FONT SIZE=2>(07) 3839 4321</FONT>
</P>
<P><FONT SIZE=2>_______________________________________________</FONT>
<BR><FONT SIZE=2>HCN mailing list</FONT>
<BR><FONT SIZE=2>HCN@ozdocit.org</FONT>
<BR><FONT SIZE=2><A HREF="http://ozdocit.org/cgi-bin/mailman/listinfo/hcn">http://ozdocit.org/cgi-bin/mailman/listinfo/hcn</A></FONT>
</P>
</BODY>
</HTML>