Viewing 15 posts - 1,966 through 1,980 (of 2,458 total)
Dwain Camps wrote this great article about this recently which was consistent with my experience using windows functions: The Performance of the T-SQL Window Functions[/url]. I suggest giving it a...
February 11, 2014 at 4:05 pm
This should get you what you need. Note my comments...
-- global temp table can be accessed from inside a string
IF OBJECT_ID('tempdb..##xmlTemp') IS NOT NULL DROP TABLE ##xmlTemp;
GO
--declare @xml nvarchar(max)-- You...
February 11, 2014 at 2:49 pm
Nevyn (2/10/2014)
I also tweaked to Nevyn's solution so that it will produce the correct answer (Nevyn's solution is very good but I think it should include WHERE rownum=1.)
Yep. Was trying...
February 10, 2014 at 5:56 pm
Had a few minutes to kill... Here's a solution using what is commonly referred to as the "Quirky Update". I included the code to make sample data...
USE tempdb
GO
IF OBJECT_ID('tempdb.dbo.dimdate')...
February 10, 2014 at 4:15 pm
First, Cudo's to Google Chrome. I just started typing this, then lost power. When I rebooted and opened Chrome my comment was still here.:w00t:
Below is a better way to create...
February 10, 2014 at 3:34 pm
Luis. Thanks for putting all this together; I wanted to reply soon but it's been a busy couple days.
I have been playing around with the code you posted and...
February 7, 2014 at 12:38 pm
Luis Cazares (2/4/2014)
... Why wouldn't you want to use a nice pre-aggregated cross tab approach?
SELECT
SUM(CASE qtr WHEN 1 THEN sales END) AS q1,
SUM(CASE qtr WHEN 2 THEN sales END) AS...
February 5, 2014 at 11:31 am
Luis Cazares (2/4/2014)
You need to change your table to a subquery involving only the grouping columns and the ones to be aggregated.
SELECT [1] AS q1, [2] AS q2, [3]...
February 4, 2014 at 5:54 pm
Ditto what Sean said. There's many people who want to help but we just can't based on what you have provided thus far.
That said, I am going to take...
February 4, 2014 at 2:02 pm
twin.devil (2/4/2014)
this link will be helpful for you to get info of ReportServer databasehttp://sornanara.blogspot.com/search/label/Query%20ReportServer%20Database%20Tables
.hope it helps
This is a great blog post/series! I don't know if this helps the OP...
February 4, 2014 at 7:20 am
Sowbhari (2/4/2014)
SELECT StartDate =
CASE WHEN CONVERT(VARCHAR(8),@Trandate,112)
BETWEEN CONVERT(VARCHAR,YEAR(@Trandate)) + '0406'
AND CONVERT(VARCHAR,YEAR(@Trandate)+1) + '0405'
THEN CONVERT(DATETIME,CONVERT(VARCHAR,YEAR(@Trandate)) + '0406')
WHEN CONVERT(VARCHAR(8),@Trandate,112)
BETWEEN CONVERT(VARCHAR,YEAR(@Trandate)-1)...
February 4, 2014 at 6:46 am
Below is a T-SQL script I created last month for this kind of thing. Note my comments, you will have to make a couple changes for this to work.
1)...
February 3, 2014 at 6:11 pm
This can still be optimized (I'm out of time here). But this should be an enormous improvement.
WITH CTE AS
(
SELECT Usr,
CASE WHEN val1=1 THEN 1 END AS val1,
CASE WHEN...
January 31, 2014 at 4:25 pm
I am looking at this. Is it possible for you to post the actual execution plan that is created when you run this query?
January 31, 2014 at 3:16 pm
Sean Lange (1/31/2014)
Alan.B (1/30/2014)
KtmGuy (1/29/2014)
Try executing this query ;UPDATE a
SET
a.Status = CASE WHEN b.action IN(1,3,4,5,6) THEN 'Y' ELSE 'N' END
FROM
TableA a
JOIN
TableB b
ON
a.SID = b.SID
Well done!...
January 31, 2014 at 1:38 pm
Viewing 15 posts - 1,966 through 1,980 (of 2,458 total)