Search
 
SCRIPT & CODE EXAMPLE
 

SQL

t sql list week start date and end date for a year

DECLARE @Date1 DATE, @Date2 DATE
SET @Date1 = DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)
SET @Date2 = DATEADD(yy, DATEDIFF(yy,0,getdate()) + 1, -1)

SELECT DISTINCT dateadd(ww, datediff(ww, 0,DATEADD(DAY,number+1,@Date1)), 0) [StartDate],
				dateadd(ww, datediff(ww, 0,DATEADD(DAY,number+1,@Date1)), 6) [EndDate]
FROM master..spt_values
WHERE type = 'P'
AND DATEADD(DAY,number+1,@Date1) < @Date2
Comment

PREVIOUS NEXT
Code Example
Sql :: create tables from xsd to sql server database c# 
Sql :: sakila database erd postgresql 
Sql :: print $dbpass 
Sql :: select between dates opstgres 
Sql :: postgresql display subquery as json 
Sql :: azure sql-datenbank 
Sql :: mamp find mysql port number mac 
Sql :: crear usuario oracle 
Sql :: which is the order of precedence among following operator IN OUT AND OR in sql 
Sql :: sql int ++ 
Sql :: sql developer format sql 
Sql :: sql query to delete row by id 
Sql :: including parameters in OPENQUERY 
Sql :: sql requete number pair 
Sql :: sql query to find difference between total no. of rows and distinct rows in sql server 
Sql :: get who is hired in february in sql 
Sql :: look at running processes redshift 
Sql :: datatype for phone number in sql 
Sql :: sql 2year 
Sql :: optimize sql query 
Sql :: what is in operator 
Sql :: mysql order by desc 
Sql :: mysql select all columns and specific fields as 
Sql :: call scalar valued function sql 
Sql :: how to select the lowest values from table per client sql 
Csharp :: dotnet install ef 
Csharp :: c# open web page in default browser 
Csharp :: how to convert string to guid c# 
Csharp :: how to make a resizable window in monogame 
Csharp :: how to reload current scene unity 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =