或许使作SQL自定义函数更方使,更快捷.
CREATE FUNCTION GetIntToDate(@IntValue int)
RETURNS datetime AS
BEGIN
declare @ReturnValue datetime
select @ReturnValue= CAST(CAST(CAST(@IntValue/1000 AS INT)+1900 as varchar(4))+'.01.01' as datetime)
select @ReturnValue=dateadd(dd,@IntValue-CAST(@IntValue/1000 AS INT)*1000-1 ,@ReturnValue)
return @ReturnValue
END