La Vita è Bella
This is where I share my knowledge to all who seeks them.
Tuesday, April 13, 2010
How to get the first day of the week in SQL Server
CREATE FUNCTION [dbo].[udf_GetFirstDayOfWeek](
@pInputDate DATETIME
)
RETURNS DATETIME
BEGIN
SET @pInputDate = CONVERT(VARCHAR(10), @pInputDate, 111)
RETURN DATEADD(DD, 1 - DATEPART(DW, @pInputDate),
@pInputDate)
END
GO
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment