Viewing 15 posts - 3,016 through 3,030 (of 4,085 total)
Without test data, it's hard to say, but I believe that this query will give you the same results, while being MUCH, MUCH simpler. I'm guessing it will also...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 18, 2015 at 2:56 pm
Isn't this the same question that you asked before?
http://www.sqlservercentral.com/Forums/Topic1693743-3077-1.aspx
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 18, 2015 at 12:10 pm
I'm guessing the problem is with the BETWEEN on your datetime field in the WHERE clause. There are a number of issues with using BETWEEN with datetime data. ...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 18, 2015 at 7:06 am
codykonior (6/16/2015)
And you don't need two temporary tables when one will do.
You don't need any temporary tables at all. The temporary tables just add unnecessary overhead.
DECLARE @Row_Batch INT =...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 17, 2015 at 8:13 am
j.grimanis (6/16/2015)
I do not want to confuse people, especially when they are trying o help me.
Below is a sample of how stored procedure seems :
PROC1
-----Procedure1 is calling...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 17, 2015 at 7:45 am
Try moving your variable declarations/assignments outside of your TRY/CATCH blocks. I'm guessing that the behavior of variable assignments in TRY/CATCH blocks is different between the two versions of SQL...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 15, 2015 at 2:24 pm
sgmunson (6/15/2015)Also, just as a general rule, almost no one uses RIGHT joins because it's just not intuitive.
I've actually wondered about this. I know this is true of left-to-right...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 15, 2015 at 7:45 am
You simply have to join to the table twice with different aliases, which is essentially what you were doing by creating two CTEs.
select o.ID, o.OrderNumber, s.MarketCenterCity AS 'SourceMKT', d.MarketCenterCity AS...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 12, 2015 at 10:17 am
Shadab Shah (6/11/2015)
Below is the error
Msg 4108, Level 15, State 1, Line 2Windowed functions can only appear in the SELECT or ORDER BY clauses.
The way to get around this is...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 12, 2015 at 7:39 am
Yes, it is possible, but I have never done it. You'll need to use the built-in Dynamic Management Views (DMV), specifically sys.dm_exec_requests which gives you information about currently running...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 12, 2015 at 7:24 am
ScottPletcher (6/11/2015)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 11, 2015 at 3:26 pm
Luis Cazares (6/11/2015)
When doing such strong and conclusive statements, you should show proof of that.
You're right, of course.
I can't give a conclusive statement even after some testing that shows that...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 11, 2015 at 3:17 pm
Luis Cazares (6/11/2015)
koles2004 (6/11/2015)
I wanna specify: the second your variant is faster than first ?
I can't assure that it's faster or better. The only way to ensure that is by...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 11, 2015 at 1:57 pm
sqlinterset (6/11/2015)
I would like to display NULL.
Then you will need to add a CASE statement like so
;
WITH complaints_ordered AS
(
SELECT
Fiscal_Week,
Complaint_Num AS c1,
CASE WHEN LAG(Fiscal_Year) OVER(PARTITION BY Fiscal_Week ORDER BY Fiscal_Year) =...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 11, 2015 at 1:47 pm
This gives the expected results with the data supplied, but you haven't said what the expected behavior should be when 2012 and 2014 have data, but 2013 and 2015 don't....
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
June 11, 2015 at 11:07 am
Viewing 15 posts - 3,016 through 3,030 (of 4,085 total)