I'm uploading a flat file I recieve into a temp table. A date in the file is in the format of 'dd-mm-yy' and is placed into a varchar field in the temp table. Is the only way to convert this to an actual date in SQL by using SUBSTRING like below or is there a better way? This is for SQL 2005.
CAST(SUBSTRING(F1,4,2) + '-' + SUBSTRING(F1,1,2) + '-' + SUBSTRING(F1,7,2) AS datetime)