Viewing 15 posts - 3,811 through 3,825 (of 4,085 total)
GilaMonster (10/29/2010)
DECLARE @date1 DATETIMEDECLARE @date2 DATETIME
SET @date1 = DATEADD(mi, 120, DATEADD(dd,0,DATEDIFF(dd,0,GETDATE())-1)) -- yesterday at 2:00 am
SET @date2 = DATEADD(mi,60,@date1)
I'm curious about why you used minutes rather than hours for the...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 29, 2010 at 4:39 pm
BenWard (10/28/2010)
thats brilliant thanks.I'm surprised there isnt an alternative version of count in sql server that returns the number of rows like a numrows() function or whatever.
Thanks
You mean like Count(DISTINCT...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 28, 2010 at 8:16 am
It uses the "quirky update". Jeff Moden wrote an article about the quirky update.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 27, 2010 at 2:28 pm
My issue with defining it as multiple tables is that you lose the fact that the order is important when you start introducing outer joins. Consider the following example:
WITH...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 26, 2010 at 12:45 pm
Actually, this is like Wave/Particle duality. In some situations, it helps to think of the joins working on multiple tables, but in other situations it helps to think of...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 26, 2010 at 9:19 am
Craig Farrell (10/25/2010)
Okay, the error message is simple enough, but I thought the point of EXCEPT was to reword the anti semi-join operation?
The purpose of EXCEPT is to handle set...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 26, 2010 at 6:40 am
You may also need to use dynamic SQL. It's really difficult to tell without DDL, sample data, and expected results to work with.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 21, 2010 at 3:00 pm
Depending on the complexity of your query, you could try FOR XML AUTO, ELEMENTS or FOR XML PATH('some value') instead of XML EXPLICIT.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 21, 2010 at 2:53 pm
Your data is missing the decimal point whose sole purpose is to indicate which part is the integer portion and which part is the decimal portion. By convention, the...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 21, 2010 at 12:11 pm
This sounds suspiciously like a homework assignment. The answer to this question is easily found with a little research. The fact that you didn't find it suggests that...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 21, 2010 at 11:15 am
Your row number is only partitioned by the Systalk_ID, but the grouping in the outer query is based on Systalk_ID, Attendance_Type, and SC_Attendance_ID. You want these to match.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 21, 2010 at 10:39 am
This should get you close to what you are looking for. Essentially it takes the intersection (A) of two sets (B) and (C) and adds the values to the...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 21, 2010 at 10:27 am
Iulian -207023 (10/21/2010)
What about storing data as int like this yyyymmdd? (year*10000 + month*100 + day)
There is a perfectly good datatype that is optimized for working with datetime data. ...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 21, 2010 at 6:38 am
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...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
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...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 15, 2010 at 1:27 pm
Viewing 15 posts - 3,811 through 3,825 (of 4,085 total)