ALTER TABLE [dbo].[FATURA] DROP CONSTRAINT [DF_FATURA_ISLEMTARIHI]
GO


 ALTER FUNCTION  [dbo].[TARIHAL]  
 (@Tarih as datetime)  

 RETURNS datetime AS  

 BEGIN  

  --return cast(FLOOR(cast(@Tarih as FLOAT)) as datetime)  
  return DATEADD(dd, 0, DATEDIFF(dd, 0, @Tarih))
 END 

GO

ALTER TABLE [dbo].[FATURA] ADD  CONSTRAINT [DF_FATURA_ISLEMTARIHI]  DEFAULT ([dbo].[TARIHAL](getdate())) FOR [ISLEMTARIHI]

GO
