<!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 5.5.2653.12">
<TITLE>RODBC</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>I'm tryuing to get the RODBC package to work with a MS Sql database (Wonderware's InSQL). I'm able to connect to the database using the following:</FONT></P>
<P><FONT SIZE=2>version</FONT>
<BR><FONT SIZE=2> _ </FONT>
<BR><FONT SIZE=2>platform i386-pc-mingw32 </FONT>
<BR><FONT SIZE=2>arch x86 </FONT>
<BR><FONT SIZE=2>os Win32 </FONT>
<BR><FONT SIZE=2>system x86, Win32 </FONT>
<BR><FONT SIZE=2>status Under development (unstable)</FONT>
<BR><FONT SIZE=2>major 1 </FONT>
<BR><FONT SIZE=2>minor 4.0 </FONT>
<BR><FONT SIZE=2>year 2001 </FONT>
<BR><FONT SIZE=2>month 10 </FONT>
<BR><FONT SIZE=2>day 29 </FONT>
<BR><FONT SIZE=2>language R </FONT>
<BR><FONT SIZE=2>> library(RODBC)</FONT>
<BR><FONT SIZE=2>library(RODBC)</FONT>
</P>
<P><FONT SIZE=2>> channel <- odbcConnect("SCADA2","ways1","LO&B*O",case="msaccess")</FONT>
<BR><FONT SIZE=2>> channel</FONT>
<BR><FONT SIZE=2>channel</FONT>
<BR><FONT SIZE=2>[1] 0</FONT>
</P>
<P><FONT SIZE=2>And an abreviated table list is:</FONT>
</P>
<P><FONT SIZE=2>...</FONT>
<BR><FONT SIZE=2>25 Runtime dbo AnalogHistory TABLE</FONT>
<BR><FONT SIZE=2>...</FONT>
</P>
<P><FONT SIZE=2>When I try to query the table, I get:</FONT>
</P>
<P><FONT SIZE=2>> test <- sqlQuery(channel,"select datetime, value from analoghistory where tagname = 'a055-re-0020_ph_pv_flt' and datetime >= 'nov 1, 2001 2:00pm'")</FONT></P>
<P><FONT SIZE=2>> test</FONT>
<BR><FONT SIZE=2>test</FONT>
<BR><FONT SIZE=2>[1] "37000 201 [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure 'sp_prepare' expects parameter '@stmt', which was not supplied."</FONT></P>
<P><FONT SIZE=2>[2] "[RODBC]ERROR: Could not SQLPrepare" </FONT>
</P>
<P><FONT SIZE=2>Any thoughts? </FONT>
</P>
<P><FONT SIZE=2>Shawn Way</FONT>
<BR><FONT SIZE=2>Tanox, Inc.</FONT>
</P>
</BODY>
</HTML>