First, use the cast function to convert the number type to the character type, and then use the cast function once to convert the character type to the date type.
The statement is as follows:
Select cast (cast (20050927 asvarchar) as datetime).
The result is as shown in the figure:
Description of cast function:
Grammar:
Cast (expression is data_type)
Parameter description:
Expression: any valid SQServer expression.
AS: used to separate two parameters, the data to be processed before AS and the data type to be converted after AS.
Data_type: the data types provided by the target system, including bigint and sql_variant, cannot use custom data types.