<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.iis.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:cs="http://blogs.iis.net/"><channel><title>Advanced Topics</title><link>http://forums.iis.net/1143.aspx</link><description>Advanced topics such as COM Programming, Log file format conversions, and Multiplex features.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>RE: Different data output when using COM</title><link>http://forums.iis.net/thread/1853789.aspx</link><pubDate>Fri, 30 Dec 2005 14:39:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1853789</guid><dc:creator>Anonymous</dc:creator><slash:comments>0</slash:comments><comments>http://forums.iis.net/thread/1853789.aspx</comments><wfw:commentRss>http://forums.iis.net/commentrss.aspx?SectionID=1143&amp;PostID=1853789</wfw:commentRss><description>That depends on what you want to do when you come across a date field with a 0 for the value.&lt;br&gt;&lt;br&gt;TO_TIMESTAMP(MyDate, 'MM/dd/yyyy HH:mm:ss') will return a NULL for those records that contain a 0.&lt;br&gt;&lt;br&gt;If you have some other date in mind for those values, you could wrap the TO_TIMESTAMP inside a COALESCE and have it supply the timestamp you want.  e.g.&lt;br&gt;&lt;br&gt;COALESCE(TO_TIMESTAMP(MyDate, 'MM/dd/yyyy HH:mm:ss'), TIMESTAMP('01/01/0000', 'MM/dd/yyyy'))&lt;br&gt;&lt;br&gt;hth</description></item><item><title>RE: Different data output when using COM</title><link>http://forums.iis.net/thread/1853787.aspx</link><pubDate>Fri, 30 Dec 2005 03:25:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1853787</guid><dc:creator>Anonymous</dc:creator><slash:comments>0</slash:comments><comments>http://forums.iis.net/thread/1853787.aspx</comments><wfw:commentRss>http://forums.iis.net/commentrss.aspx?SectionID=1143&amp;PostID=1853787</wfw:commentRss><description>&lt;P&gt;Daniel,&lt;/P&gt;&lt;P&gt;Thanks! Putting .dtLines=0 has solved the problem.&lt;/P&gt;&lt;P&gt;For your sugesstion using TO_TIMESTAMP, I cannot use it for the field as some of the row&lt;BR&gt;have&amp;nbsp;value like "0".&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;P&gt;11/08/2005 23:23:21&lt;BR&gt;11/08/2005 23:25:12&lt;BR&gt;0&lt;BR&gt;11/08/2005 23:25:30&lt;BR&gt;0&lt;BR&gt;11/08/2005 23:26:01&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Is there a way to conditionally check if the file have inconsistant data type as above.&lt;/P&gt;&lt;P&gt;Cheers,&lt;BR&gt;Goboxe&lt;/P&gt;</description></item><item><title>RE: Different data output when using COM</title><link>http://forums.iis.net/thread/1853784.aspx</link><pubDate>Thu, 29 Dec 2005 15:34:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1853784</guid><dc:creator>Anonymous</dc:creator><slash:comments>0</slash:comments><comments>http://forums.iis.net/thread/1853784.aspx</comments><wfw:commentRss>http://forums.iis.net/commentrss.aspx?SectionID=1143&amp;PostID=1853784</wfw:commentRss><description>I believe you are going to have to force LP to import all fields as strings and explicitly cast whatever fields you need away from string.&lt;br&gt;&lt;br&gt;Try adding ".dtLines = 0" to the "with oInputFormat" block and then change field2 in your query to have a TO_TIMESTAMP around it.&lt;br&gt;&lt;br&gt;hth.</description></item><item><title>Different data output when using COM</title><link>http://forums.iis.net/thread/1850552.aspx</link><pubDate>Thu, 29 Dec 2005 04:52:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1850552</guid><dc:creator>Anonymous</dc:creator><slash:comments>0</slash:comments><comments>http://forums.iis.net/thread/1850552.aspx</comments><wfw:commentRss>http://forums.iis.net/commentrss.aspx?SectionID=1143&amp;PostID=1850552</wfw:commentRss><description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have used COM to convert data from TSV to SQL. Apparently, output for one of the fields i.e PHONE_NUMBER&lt;BR&gt;was converted incorrectly. This happened when the data have prefix "00"&lt;/P&gt;&lt;P&gt;E.g.&lt;BR&gt;&amp;nbsp;"0067891289128" is stored as "67891289128" in SQL Server&lt;BR&gt;&amp;nbsp;"00897878288" is stored as "897878288"&lt;/P&gt;&lt;P&gt;The prefix "00" have been removed.&lt;/P&gt;&lt;P&gt;The SQL statement is as below:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SELECT REPLACE_STR(REPLACE_STR( field1, '[', ''),']','') as CallSignature, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;field2 as CallRequestTime, field3 as PhoneNr &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;FROM Me.txtImportPath.Text&lt;/P&gt;&lt;P&gt;Please see the full code below:&lt;/P&gt;&lt;P&gt;Private Sub ExportLogsToDatabaseByRecSet()&lt;BR&gt;&amp;nbsp;&amp;nbsp;Try&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim oLogQuery As New LogQueryClass&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim oInputFormat As New MSUtil.COMTSVInputContextClass&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim oOutputFormat As New MSUtil.COMSQLOutputContextClass&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim oRecordSet As MSUtil.ILogRecordset&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim strTemp As String&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;With oInputFormat&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.headerRow = False&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;End With&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;With oOutputFormat&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.createTable = True&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.server = "localhost"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.database = "T....."&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.driver = "SQL Server"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.username = "t..."&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.password = "t......."&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;End With&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim recCount As Int16&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim strQuery As String&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;strQuery = "select REPLACE_STR(REPLACE_STR( field1, '[', ''),']','') as CallSignature, "&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;strQuery &amp;amp;= " field2 as CallRequestTime, "&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;strQuery &amp;amp;= " field3 as PhoneNr "&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;strQuery &amp;amp;= " from " &amp;amp; Me.txtImportPath.Text&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;oRecordSet = oLogQuery.Execute(strQuery, oInputFormat)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Do While Not oRecordSet.atEnd&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim oRecord As MSUtil.ILogRecord&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;oRecord = oRecordSet.getRecord&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;strTemp = oRecord.getValue(0)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;oRecordSet.moveNext()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AddLogRecords(oRecord.getValue(0), oRecord.getValue(1), oRecord.getValue(2))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;recCount += 1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Me.txtImportedCount.Text = recCount&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Loop&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;oRecordSet.close()&lt;BR&gt;&amp;nbsp;&amp;nbsp;Catch ex As Exception&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;txtErrorMsg.Text &amp;amp;= "ExportLogsToDatabaseByRecSet : " &amp;amp; ex.Message &amp;amp; vbCrLf&lt;BR&gt;&amp;nbsp;&amp;nbsp;End Try&lt;BR&gt;&amp;nbsp;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;T.I.A&lt;/P&gt;&lt;P&gt;Kind regards, &lt;BR&gt;Goboxe&lt;/P&gt;</description></item></channel></rss>