Default date in a derived column expression

one of my SSIS packages use this expression to put todays date in if it is NULL:

(ISNULL(datejs)) ? GETDATE() : datejs

however, what I really want to do though is put a default date in like '2007-01-01' but I get syntax error because SSIS thinks it's a string, which it is I suppose.

Is it possible to do what I want it to?

Thanks

[421 byte] By [bobbins] at [2007-12-26]
# 1

Try casting it

(ISNULL(datejs)) ? (DT_DBTIMESTAMP)"2007-01-01" : datejs

LarryCharlton at 2007-9-4 > top of Msdn Tech,SQL Server,SQL Server Integration Services...
# 2
Fresh from the Integration Services Expression Reference section of Books Online, we have the GETDATE (http://msdn2.microsoft.com/en-US/library/ms139875.aspx) topic. So using GETDATE is possible, but sounds like a variable or literal casted as you suggest is actually what is needed here.
DarrenSQLIS at 2007-9-4 > top of Msdn Tech,SQL Server,SQL Server Integration Services...
# 3
Larry Charlton wrote:

Try casting it

(ISNULL(datejs)) ? (DT_DBTIMESTAMP)"2007-01-01" : datejs

That's done it. Thank You.

bobbins at 2007-9-4 > top of Msdn Tech,SQL Server,SQL Server Integration Services...

SQL Server

Site Classified