I have pretty much the same idea as kevriley
declare @invaliddate varchar(6)
set @invaliddate = '081709'
declare @validdate datetime
select @validdate = convert(datetime, '20'+right(@invaliddate,2) + '-' + left(@invaliddate, 2) + '-' + substring(@invaliddate, 3,2))
print convert(varchar, @validdate, 112)
In this instance you can store the @validdate in a sql table as datetime datatype. But when you retrieve it you display it in the format required.
🙂
----------------------------------------------------------------------------------------------
Struggling to find the question?
http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx