Use DATEADD
DECLARE @y INT = 2015,
@w INT = 37;
SELECT
[StartOfWeek] = DATEADD(wk,DATEDIFF(wk,7,CAST(@y AS NVARCHAR(100))) + (@w-1),7);
More Related Contents:
- Subquery in select not working in SQL Server
- Storing images in SQL Server?
- Import Multiple CSV Files to SQL Server from a Folder
- Confused about UPDLOCK, HOLDLOCK
- Retrieve column definition for stored procedure result set
- Using varchar(MAX) vs TEXT on SQL Server
- SQL Server – Remove all non-printable ASCII characters
- Creating audit triggers in SQL Server
- Regular Expressions in SQL Server servers?
- Unique constraint on multiple columns
- Connecting to MS SQL Server with Windows Authentication using Python?
- TSQL Email Validation (without regex)
- Dynamic SQL results into temp table in SQL Stored procedure
- Diagnosing Deadlocks in SQL Server 2005
- How to find the port for MS SQL Server 2008?
- A connection was successfully established with the server, but then an error occurred during the login process. (Error Number: 233)
- TABLOCK vs TABLOCKX
- How to convert number of minutes to hh:mm format in TSQL?
- What happens if you don’t commit a transaction to a database (say, SQL Server)?
- Dynamically assign filename to excel connection string
- Temporarily disable all foreign key constraints
- SQL Server Dependencies
- SQL Server Passthrough query as basis for a DAO recordset in Access
- T-SQL query to show table definition?
- Why do I get the error “Xml data type is not supported in distributed queries” when querying a linked server for non-xml data?
- Cannot find either column “dbo” or the user-defined function or aggregate “dbo.Splitfn”, or the name is ambiguous
- Date range overlapping check constraint
- SQL Server equivalent to Oracle’s CREATE OR REPLACE VIEW
- Using Full-Text Search in SQL Server 2008 across multiple tables, columns
- Oracle sequence but then in MS SQL Server