Viewing 15 posts - 3,826 through 3,840 (of 4,087 total)
From what I understand, there is some overhead for every transaction. With a set-based query, this overhead is performed once; with a cursor, this overhead is performed for every...
October 19, 2010 at 4:03 pm
I think I found the problem. Your original query was only grouping on the Customer Number, but you want to group on the Order Number as well. Otherwise...
October 15, 2010 at 1:27 pm
You need to include a CASE statement in your HAVING clause.
Select @constituency, o.customer_no
, Count(l.per_no) AS AllPerf
, COUNT(CASE p.season WHEN 165 THEN l.perf_no...
October 15, 2010 at 11:36 am
Michael Valentine Jones (10/15/2010)
selectDaysTillChristmas =
datediff(dd,getdate(),dateadd(yy,datediff(yy,-1,getdate()),-7))
But this will give you negative numbers from Dec. 26-31. Here is the modified code to always give you the NEXT Christmas.
select DateDiff(Day, GetDate(), dateadd(yy,datediff(yy,-1,DateAdd(Day,...
October 15, 2010 at 11:22 am
Maybe what you really want to do is create a view. That way you can use the trick of specifying the TOP (100) PERCENT, so that you can specify...
October 15, 2010 at 11:00 am
This is exactly what the PIVOT operator was designed for. Check it out in BOL.
That being said, using a crosstab is often more efficient.
select datepart(ww, created) as Week,
COUNT(CASE s.commonname...
October 15, 2010 at 10:41 am
I think the best measure is probably
(totalRecords - uniqueRecords)/totalRecords
In your example that would give 75%. The hard part is, of course, identifying the unique records.
Drew
October 15, 2010 at 10:10 am
I don't see that how often it is executed has any bearing on the issue unless it starts blocking itself. I wouldn't immediately target the FOR XML as being...
October 14, 2010 at 3:18 pm
Eric1/2aB (10/14/2010)
I am trying to make a case to have this code redesigned in a way that FOR XML is not needed.
Do you have a personal vendetta against the FOR...
October 14, 2010 at 10:29 am
tyson.price (10/13/2010)
Sorry about the formatting. I must have used the code tags wrong. 🙂
The "/" only goes in the closing tag. You have it in both the opening...
October 13, 2010 at 8:49 am
ravimodi (10/12/2010)
October 13, 2010 at 8:36 am
You beat me to it, but I'm posting mine anyhow, because there are some points that I wanted to address.
WITH Charges AS (
SELECT Account, Sum(qty*amount) AS Total_Charges
FROM test_charges AS tc
INNER...
October 12, 2010 at 3:01 pm
Derrick Smith (10/12/2010)
AND (NOT email IN (SELECT email FROM failures))
AND (NOT email IN (SELECT email FROM removes))
AND (NOT email IN (SELECT email FROM contacts));
I'd be willing...
October 12, 2010 at 2:29 pm
aniccadhamma (10/12/2010)
October 12, 2010 at 12:59 pm
PSB (10/11/2010)
The condtition is if the "Name" comes in as NULL then the "ID" should be NULL
Else...
October 12, 2010 at 10:56 am
Viewing 15 posts - 3,826 through 3,840 (of 4,087 total)