CREATE FUNCTION [dbo].[udf_Convert_INT_Date]
(
@Date_In INT
)
RETURNS datetime
AS
BEGIN
DECLARE @date_out datetime
SET @date_out = CONVERT(datetime, CAST(@date_in AS CHAR(8)), 101)
RETURN @date_out
END
--Execute
SELECT DateKey,
CONVERT(VARCHAR(25),AdventureWorksDW2008R2.dbo.udf_convert_int_date
(DateKey),103) AS [ConvertedDate]
FROM dbo.DimDate
No comments:
Post a Comment