![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi: There is a datetime field in a SQL Server database. Using ADO, I extract the maximum date as follows: strSQL = "SELECT MAX([Timestamp]) AS MaxDate FROM " & TableName which I then execute. I then set a variable to this value: varMaxDate = objRS.Fields("MaxDate") and then I use this to set a SQL Statement: sSQLStatement = "SELECT * FROM " & TableName & " WHERE Timestamp >= '" & _ varMaxDate & "'" The problem is, the resulting SQL Statement is a date, not a datetime. What is the best way to create a SQL Statement that uses a real datetime. This SQL Statement is to be used in a SQL Server DTS package as a query against a Sybase database via ODBC (I'm using VB Script in an ActiveX Script Task). So my goal is to look in the target table (SQL Server) for the maximum datetime, and then get any records in the source (Sybase) with a datetime greater than what is in the SQL Server database. Thanks, Kayda |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
I tried doing that but I get a type mismatch error when I run the package. How is that possible? It is a scripting language so I didn't declare a datatype when I declared the variable. I tried also supplying the zero argument as per the description at: http://msdn.microsoft.com/library/de...atdatetime.asp Any ideas why that is happening? Thanks, Kayda |
![]() |
| Thread Tools | |
| Display Modes | |
| |