No announcements
Found 158160 threads
-
1 Votes
Using DATEPART() to return both the month and year
DECLARE @BeginDate varchar(20) SET @BeginDate = CONVERT(VARCHAR(2),DATEPART(MONTH,DATEADD(MONTH,-6,GETDATE()))) + '-' + ...Answered | 12 Replies | 12038 Views | Created by SQL_4_Me - Tuesday, March 27, 2012 8:10 PM | Last reply by SQL_4_Me - Wednesday, March 28, 2012 2:38 PM -
0 Votes
T-SQL DATEPART: Cannot get number of weeks in 2 year timespan
DECLARE @TableX table ( CustomerID Int, InvoiceDate datetime ) Declare @Datecounter datetime set @Datecounter ...Answered | 1 Replies | 7209 Views | Created by Dynasty25 - Wednesday, March 24, 2010 10:02 PM | Last reply by Gerry Phillips - Thursday, March 25, 2010 2:00 AM -
1 Votes
Year or Datepart versus Table with Date Groupings
I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year.Answered | 7 Replies | 1043 Views | Created by AHubbard440 - Thursday, March 5, 2015 7:40 AM | Last reply by AHubbard440 - Wednesday, March 11, 2015 4:27 AM -
1 Votes
Datepart Function
I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year.Answered | 4 Replies | 5253 Views | Created by CIWorker - Monday, January 21, 2013 6:34 PM | Last reply by --CELKO-- - Monday, January 21, 2013 7:15 PM -
1 Votes
Datepart causes table scan
([year], dt) = 1998 AND DATEPART([month], dt) = 1 AND DATEPART([day], dt) IN (1, 2); GO SET SHOWPLAN_TEXT OFF; GO ALTER TABLE ...Answered | 6 Replies | 5955 Views | Created by Mr.Khaled - Monday, June 6, 2011 1:00 PM | Last reply by Arunraj.C - Sunday, June 12, 2011 2:40 AM -
1 Votes
Is this an inconsistency between DATEPART and DATENAME?
Try the below and see the result SELECT DATENAME(dw, 2), DATENAME(year, 2), DATENAME(month, 2), DATENAME(day, 2), DATENAME(dw, ...Answered | 4 Replies | 4670 Views | Created by AshikRahman - Wednesday, May 5, 2010 10:27 AM | Last reply by K H Tan - Monday, May 10, 2010 1:35 PM -
0 Votes
DATEPART problem
= DATEADD(DAY,DATEDIFF(DAY,0,GETDATE()),0) AND TheHour = DATEPART(HOUR,GETDATE()) GROUP BY TheHour, TheDate ...Answered | 5 Replies | 23791 Views | Created by Garmon648 - Tuesday, December 22, 2009 7:10 PM | Last reply by Adam Haines - Tuesday, December 22, 2009 7:42 PM -
1 Votes
Datepart function
create table #retailer(cash_Exp_date datetime) alter table #retailer add constraint ...Answered | 6 Replies | 1812 Views | Created by AshishSingh_DWH - Wednesday, February 12, 2014 10:19 AM | Last reply by Ashish Pandey - Wednesday, February 12, 2014 11:41 AM -
3 Votes
DatePart determinism
If you happen to need the deterministic version of Week of Year: ALTERTABLE dbo.Dates ADD WeekOfYear ASAnswered | 4 Replies | 7917 Views | Created by Matthew B - Friday, January 20, 2012 2:49 PM | Last reply by Irawan Soetomo - Thursday, March 7, 2019 3:19 AM -
0 Votes
Get Quarterly Data Using DatePart()
Hello, You GROUP and SELECT by date, change it to quarter, too: Select SUM(totalitemssold) [Sum For Quarter] ,datepart(QUARTER,d1) ...Answered | 1 Replies | 524 Views | Created by RonPaulWearsRedSocks - Friday, September 16, 2016 12:06 PM | Last reply by Olaf Helper - Friday, September 16, 2016 12:13 PM -
5 Votes
DatePart(Week, @Date) Returns wrong weeknumber?
ISO week-numbering years have a year numbering which is approximately the same as the Gregorian years, but not exactly (see below).Answered | 10 Replies | 36782 Views | Created by Josje - Monday, January 11, 2010 8:08 AM | Last reply by Igor Gelin - Thursday, October 18, 2012 12:48 PM -
0 Votes
Get range when using DATEPART (week,XXX)
> I have a table that have a date of a transaction, somebody request me the week, so I add the DATEPART and a year column on the SELECT statement, now they want me to ...Answered | 4 Replies | 2921 Views | Created by Gilberto H_ - Thursday, August 22, 2013 1:30 PM | Last reply by --CELKO-- - Thursday, August 22, 2013 4:39 PM -
0 Votes
how to get last year last month and Year
Try the below: Declare @str Varchar(10) = '201101' Select Cast(DatePArt(year,DATEADD(year,1,Convert(Date,@str + '01'))) as varchar(10)) + ...Answered | 5 Replies | 3219 Views | Created by prateep reddy - Tuesday, August 14, 2012 9:59 AM | Last reply by Hasham Niaz - Tuesday, August 14, 2012 2:56 PM -
0 Votes
SSIS Time Expression – Datepart
NULL(DT_DBTIMESTAMP) : ...Answered | 2 Replies | 1825 Views | Created by Mpumelelo S - Tuesday, September 24, 2013 9:14 AM | Last reply by Mpumelelo S - Tuesday, September 24, 2013 12:07 PM -
0 Votes
Using DatePart to find month is not working in IF Then statement
Quotes if text (DatePart returns an INTEGER) and none if numeric.Answered | 4 Replies | 1166 Views | Created by JamesLNeal - Tuesday, April 30, 2013 5:49 PM | Last reply by JamesLNeal - Tuesday, April 30, 2013 7:10 PM -
0 Votes
How to use DatePart Weekday in Access Web App?
However in a calculated table field it only works with Year, Month and Day.Answered | 7 Replies | 1343 Views | Created by Loumeer - Wednesday, February 17, 2016 12:24 PM | Last reply by Karl Donaubauer - Thursday, February 18, 2016 9:22 AM -
0 Votes
Choosing a Year
Modify your WHERE clause as follows: WHERE DATEPART(YEAR, e.eecDateOfLastHire) = @paramYear AND EecDateOfTermination IS NOT NULL ....Answered | 3 Replies | 2934 Views | Created by rqwew - Monday, June 4, 2012 4:32 PM | Last reply by Elvis Long - Wednesday, June 6, 2012 8:26 AM -
0 Votes
Need to datepart plus 2 positions
select RIGHT('00'+ cast( DATEPART( MONTH, getdate() ) as varchar) ,2) Sergio Sánchez Arias AYÚDANOS A AYUDARTEAnswered | 3 Replies | 1213 Views | Created by CIWorker - Friday, March 15, 2013 6:31 PM | Last reply by Sergio S Arias - Friday, March 15, 2013 7:12 PM -
0 Votes
Semester and quarte of year to set
I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year.Answered | 8 Replies | 11353 Views | Created by DIEGOCTN - Wednesday, January 16, 2013 4:17 PM | Last reply by --CELKO-- - Thursday, June 23, 2016 1:12 AM -
0 Votes
Month and year parameter
from mytable t1 where datepart(month, t1.yourdatefield) = @month and datepart(year, ...Answered | 4 Replies | 4094 Views | Created by ms_crm - Thursday, July 2, 2009 1:28 PM | Last reply by Isham H - Thursday, July 2, 2009 3:18 PM - Items 1 to 20 of 158160 Next ›
No announcements