SQL Server can implicitly cast strings in the form of 'YYYYMMDD' to a datetime - all other strings must be explicitly cast. here are two quick code blocks which will do the conversion from the form you are talking about:
version 1 uses unit variables
----------:
BEGIN
DECLARE @input VARCHAR(8), @mon CHAR(2),
@day char(2), @year char(4), @output DATETIME
SET @input = '10022009' --today's date
SELECT @mon = LEFT(@input, 2), @day = SUBSTRING(@input, 3,2), @year = RIGHT(@input,4)
SELECT @output = @year+@mon+@day
SELECT @output
END
version 2 does not use unit variables:
BEGIN
DECLARE @input CHAR(8), @output DATETIME
SET @input = '10022009' --today's date
SELECT @output = RIGHT(@input,4) + SUBSTRING(@input, 3,2) + LEFT(@input, 2)
SELECT @output
END
Both cases rely on sql server's ability to do that implicit conversion.