Interview Question in Data Transformation Services (DTS)


 

Interview Question :: DTS Package Using GetDate()


hello:)
I am trying to create a DTS Package and I have encountered a problem regarding the DATETIME. I wanted to get the data from yesterday (GETDATE()-1), it doesn't seem to run in DTS.
My code looks like this:

DECLARE @TRANSACTIONDATE DATETIME
SET @TRANSACTIONDATE = GETDATE()-1
.
.
.
WHERE SPSH.INPUTDATE = @TRANSACTIONDATE

The error says:
[INTERSOLV][ODBC SQL Server driver][SQL Server]Operand type clash: INT is incompatible with DATETIME

thanks:)
Answers to "DTS Package Using GetDate()"
RE: DTS Package Using GetDate()?

What you're doing is comparing a date time with a a number... is SPSH.INPUTDATE a datetime field?



EDIT: Try this:



WHERE CONVERT(VARCHAR, SPSH.INPUTDATE, 101) = CONVERT(VARCHAR, @TRANSACTIONDATE, 101)



That should turn both fields in a string of the format mm/dd/yyyy.



email = answers@allyoushouldknow.com
 
Vote for this answer ::  
Update Alert Setting