Hey guys,
I am using PowerShell to parse a massive CSV with the ACE OLEDB driver as its far more efficient than directly importing the CSV and then modifying it as needed. The imported columns are Facility, User, NTUserID, UPN, Last Accessed Date, and Last Enable Date. As this is how the spreadsheet comes to me, I do not have a choice in spaces in the headers.
My query is as follows:
Now when I run that, the people that had null values for Last Accessed Date are not included in the query, even though they should be as I am selecting them with a date of a year ago from today if they have a null value.
Now I thought that it wasn't replacing the null value correctly, so I ran just the following:
Without the where statement, the exported csv from that query does contain the user with the correctly replaced date if they have a null value. Then when I re-add in the WHERE clause from above, the people who had null values are missing from the output, but the original people with dates in the CSV who meet the criteria are still included in the output.
Can anyone chime in here as to what is going on?
I am using PowerShell to parse a massive CSV with the ACE OLEDB driver as its far more efficient than directly importing the CSV and then modifying it as needed. The imported columns are Facility, User, NTUserID, UPN, Last Accessed Date, and Last Enable Date. As this is how the spreadsheet comes to me, I do not have a choice in spaces in the headers.
My query is as follows:
Select [Facility], [User], [NTUserID], [UPN], IIf(IsNull([Last Accessed Date]), (DATE() -365), [Last Accessed Date]) AS [Last Accessed Date], IIf(IsNull([Last Enable Date]), (DATE() -365), [Last Enable Date]) AS [Last Enable Date] from csv WHERE [Last Enable Date] < (DATE() -90) AND [Last Accessed Date] < (DATE() -90)
Now when I run that, the people that had null values for Last Accessed Date are not included in the query, even though they should be as I am selecting them with a date of a year ago from today if they have a null value.
Now I thought that it wasn't replacing the null value correctly, so I ran just the following:
Select [Facility], [User], [NTUserID], [UPN], IIf(IsNull([Last Accessed Date]), (DATE() -365), [Last Accessed Date]) AS [Last Accessed Date], IIf(IsNull([Last Enable Date]), (DATE() -365), [Last Enable Date]) AS [Last Enable Date] from csv
Without the where statement, the exported csv from that query does contain the user with the correctly replaced date if they have a null value. Then when I re-add in the WHERE clause from above, the people who had null values are missing from the output, but the original people with dates in the CSV who meet the criteria are still included in the output.
Can anyone chime in here as to what is going on?