Handling NULL values in Derived Column


hi,

i have incoming data in format

08301995 date in string format.

i need convert datetime.

for using expression

substring((dt_wstr)dob,5,4)+"-"+substring((dt_wstr,8)dob,1,2)+"-"+substring((dt_wstr,8)dob,3,2)+" 00:00:00.000"

which working fine if there no null values. failing when sees null values

i have added function handle null values , here expression


isnull(dob) ? "null(dt_dbtimestamp,50)" : substring((dt_wstr)dob,5,4)+"-"+substring((dt_wstr,8)dob,1,2)+"-"+substring((dt_wstr,8)dob,3,2)+" 00:00:00.000"

which supposed put in null value in output column when see null value in incoming column , if doesnt has convert date datetime.

any ideas of missing here

thanks

avinash meka

use this
(isnull(dob) || trim(dob) == "") ? null(dt_dbtimestamp) : (dt_dbtimestamp)(substring(dob,5,4) + "-" + substring(dob,1,2) + "-" + substring(dob,3,2))
nitesh rai- please mark post answered if answers question


SQL Server  >  SQL Server Integration Services



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........