Posted: 12/8/2011
Hello All,
I am having an issue with the date. I am having 2 tables one is raw and one is production. I need to load the production table with the raw table.Their definitions and the data both are same.But I just need to modify the data types when it comes to production table. I have a end_date column in the raw table which is varchar and it has some values as null. I have defined the data type for my end_date in production table as Date. So when the end date comes to production it is inserting something like 1900-01-01 in place of null.But I dont want that value to be displayed like that. I want that value to be null. Any help is much appreciated.
Thanks
sqlkala,
Traditionally, when you are loading a datawarehouse with data and there are no values found during a lookup operation a value assigned to the NULL record is returned. This is what is happening to you and the reason for you getting the 1900-01-01 date. That date is referred to many as a date assigned to the unknown record and is usually in your date dimension table as a datesk (surrogate key). In my opinion, I would keep this value if you want a date in the column. I would steer away from having NULL's in your table when possible due to the performance hit. If you really must have NULL in the column, (assuming you are using a sql query to pull the data since I didn't see any reference to see HOW you were loading the data) then you need to wrap the date column in question with ISNULL(datecolumn, NULL).
Good luck,
Brian K. McDonald, sqlbigeek
Thanks so much for the reply Brian. I used ISNULL and it worked.
Thanks again
I"m glad it helped you. Can you please mark this as answered?