Assuming datepart is required, the following 9 results were found.
12-Jul-2015 28 This query in T-SQL (SQL Server 2008 R2) for CMIS Facility SELECT calendar.WeekNumber AS AcademicWeek, CAST(DATEPART(dd, calendar.StartDate) AS VARCHAR(2)) + '-' + SUBSTRING(DATENAME(mm, calendar.StartDate), 1, 3) + '-' +...
one RDL or SSRS Solution. I could do a dataset per SQL query but it doesn't seem that ideal. In Theory: SELECT ItemName, DATEPART(dayofyear, ItemDate) as DayOfYear, DATEPART(year, ItemYear) AS YearRun, COUNT(ItemName) AS Counter FROM TableName WHERE...
DATALENGTH(string) Dates / Times Weekday Name DAYNAME(now()) DATENAME(dd, getdate()) Weekday Number DAYOFWEEK(now()) DATEPART(dw, getdate()) Month Name MONTHNAME(now()) DATENAME(mm, getdate()) Month Number MONTH(now()) DATEPART(mm, getdate()) European...
= DATEADD(s,0,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0)) --First day to display on calendar SET @StartDate = DATEADD(DAY,-DATEPART(WEEKDAY,@StartDate)+1,@StartDate) --Last day of month SET @EndDate = DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0))...
+ " 00:00:00") Date back into String -- Converting yyyy-mm-dd hh:ii:ss to ddmmyyyy RIGHT("00" + (DT_STR,2,1252)DATEPART("dd",DateVerified), 2) + RIGHT("00" + (DT_STR,2,1252)DATEPART("mm",DateVerified), 2) + (DT_STR,4,1252)DATEPART("yyyy",DateVerified)
BEGIN -- SET YEAR RANGE (1912 - 1994: for Birthdate specifically: Older than 18 but younger than 100) SET @MinYear = DATEPART(YEAR,GETDATE())-100; -- 100 years ago from today SET @MaxYear = DATEPART(YEAR,GETDATE())-18; -- 18 years ago from today -- GET...
BEGIN -- SET YEAR RANGE (1912 - 1994: for Birthdate specifically: Older than 18 but younger than 100) SET @MinYear = DATEPART(YEAR,GETDATE())-100; -- 100 years ago from today SET @MaxYear = DATEPART(YEAR,GETDATE())-18; -- 18 years ago from today -- GET...
{ // as this is a date from CRM (atomic date format), arrange so it can be sorted alphabetically in reverse order v_DatePart = v_SortingKey.getPrefix("T").toDate().toString("yyyy-MM-dd"); v_TimePart =...
hour before I gave up trying to get SWITCH to work. Instead I cheated and got the ordinal in the Transact-SQL query: CASE DATEPART(DAY, [MyDateValue]) WHEN 1 THEN 'st' WHEN 21 THEN 'st' WHEN 31 THEN 'st' WHEN 2 THEN 'nd' WHEN 22 THEN 'nd' WHEN 3 THEN...