SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FN_VEM_TARIH]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
BEGIN
execute dbo.sp_executesql @statement = N'CREATE FUNCTION [dbo].[FN_VEM_TARIH]
(
	@Tarih datetime
)
RETURNS nvarchar(8)
AS
BEGIN
	RETURN CONVERT(NVARCHAR(8), @Tarih, 112)
END
' 
END

GO


