Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

yyyymmdd to date in SQL Server 2008 R2 - null in field issue

$
0
0

I'm pulling raw files from DB2 into SQL Server 2008 R2. I'm staging a report with a simple table, but want to convert the text yyyymmdd fields to actual dates in SQL Server.

This works just fine - except when I hit a NULL or blank - I'm looking for easiest way to either use an IF or ISNULL or CASE - I've read a ton of options that all dance around what I'm trying to do.

This file will run every 2 hours...

SQL
SELECTCONVERT(DATETIME,CONVERT(VARCHAR(8),ECL.LUDTE2))AS"Est Date"INTOdbo.DAILYREPORTFROMdbo.ECLECL

Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>