Viewing 15 posts - 3,196 through 3,210 (of 8,731 total)
Let's say you run this yesterday, which is Monday of week 12, which goes from March 13 to March 19.
Should you compare it to week 12 of 2015? Or week...
March 15, 2016 at 1:45 pm
snomadj (3/15/2016)
Background:
2008 R2.
Reports I need will not be overly complex / resource intensive.
I have 20 odd instances...
March 15, 2016 at 8:13 am
I'm using 2 variables, because I don't have sample data provided by you.
I'm using @StartDT which for you is either QueueDate or StartDate if QueueDate is null.
This is translated...
March 15, 2016 at 8:02 am
I would upload the file using bulk insert or something similar to avoid the pivot and the additional split. But I was waiting for a reply from the OP.
March 14, 2016 at 2:42 pm
ZZartin (3/14/2016)
SELECT CAST( (DATEDIFF(second, '3/14/2016', getdate()) / 60) / 60 AS varchar) + ':' + CAST( (DATEDIFF(second,...
March 14, 2016 at 2:37 pm
jimtimber (3/14/2016)
March 14, 2016 at 2:31 pm
Why use a CASE statement?
SELECT DATEDIFF(ss,ISNULL(QueueDate,StartDate),EndDate)
For duration, here's a formula using date/time calculations.
DECLARE @StartDT DATETIME2
,@EndDT DATETIME2
;
SELECT @StartDT =...
March 14, 2016 at 2:20 pm
Just add it to your query?
SELECT @@SERVERNAME,
p.name AS [loginname] ,
p.type ,
...
March 14, 2016 at 11:09 am
LinksUp (3/14/2016)
I'm not sure why this has not been mentioned yet since it is a standard construct to get rows between dates.
I would use something like this:
declare @UserDate date...
March 14, 2016 at 10:37 am
Jack Corbett (3/14/2016)
Luis Cazares (3/14/2016)
Jack Corbett (3/14/2016)
macdca (3/14/2016)
March 14, 2016 at 10:08 am
Eric M Russell (3/14/2016)
Jeff Moden (3/14/2016)
andrew gothard (3/14/2016)
Wayne West (8/3/2015)
Fast/Cheap/Correct: choose two.
Also, bear in mind, if you fail to choose Correct, you can forget about the other two...
March 14, 2016 at 9:39 am
Jack Corbett (3/14/2016)
macdca (3/14/2016)
"or you need to convert the column to a date without time (no index seeks possible)." - how do I do that?
CONVERT(DATE, ScheduledActivity.ScheduledDateTime)
As the number...
March 14, 2016 at 8:58 am
Set the parameter as a date type, then change the condition to this:
WHERE ScheduledActivity.ScheduledStartTime >= @Date
AND ScheduledActivity.ScheduledStartTime < DATEADD(DD,1,@Date)
Don't use strings if they're not needed.
March 14, 2016 at 8:14 am
Don't convert the column's data types, especially from date/time data types to strings.
Convert the parameters to the column's data type.
It should look like this:
ScheduledActivity.ScheduledDateTime = CONVERT(datetime, '13/04/2016', 103)
If you don't...
March 14, 2016 at 8:00 am
I actually like to keep the COUNT. It will eliminate NULL values and the intention is clear.
Count(CASE WHEN [visit_date] Between '20160201' And '20160229' THEN [registration_cd] END)...
March 14, 2016 at 7:50 am
Viewing 15 posts - 3,196 through 3,210 (of 8,731 total)