Compare Oracle and SQL Server Dates

Oracle and SQL Server databases use different date/time resolutions, which poses a problem when you compare times from the two databases: The times will rarely be equal. Solve this problem by allowing for a margin of error. Treat the dates and times as floating-point numbers and remember that each day is equal to the whole number 1, and there are 86,400 seconds in a day. This function matches times within five seconds (default) of one another:

Public Function MatchTime(adoFldOracle As ADODB.Field, _	adoFldSQLServer As ADODB.Field, _	Optional ByVal Tolerance As Long = 5) As Boolean	Dim dtOracle As Date	Dim dtSQLServer As Date	Dim dblTolerance As Double	Const OneSecond As Double = 1 / 86400	dblTolerance = OneSecond * Tolerance	dtOracle = adoFldOracle.Value	dtSQLServer = adoFldSQLServer.Value	If ((dtOracle > (dtSQLServer + dblTolerance)) Or _		(dtOracle < (dtSQLServer - dblTolerance))) Then		MatchTime = False	Else		MatchTime = True	End IfEnd Function

Andy Clark, Richmond, Va.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS