I am copying information from one table to another. There is one field which is an nvarchar and should in fact contain dates in the following format: mm/dd/yyyy or mm/dd/yy
I am going to copy that date into another field which is actually a datetime field.
I am using the following sql
CONVERT(VARCHAR(255), CONVERT(DATE, LastUSEntry), 101) as ArrivalDateD,
the only problem is that there are entries in "LastUSEntry" that are NOT dates or they are not in the correct format. Some say "NA" or "1/1/02". I Only want to copy over dates that can be converted into the datetime format, such as those in mm/dd/yy or mm/dd/yyyy
How can I do this ? Otherwise right now the sql above would fail because of those entries that aren't dates. Also there are null fields, I don't think those will be a problem but just in case I mention it.
I am using SQL 1008R2