Viewing 15 posts - 1,336 through 1,350 (of 4,081 total)
Robert, I am saying this seriously and not sarcastically. I question some of your assumptions about SQL if you think that high CPU cycles are a good...
September 27, 2010 at 12:48 pm
Again, this sounds like spreadsheet work. You have no attributes to your define your sets for calculation other than Row #1, Row #2, Row #3. Are...
September 27, 2010 at 12:36 pm
If you know the number of columns, then you know how many sum() statements to generate. In your example above:
insert into tbl_a
select 4, sum(amt1), sum(amt2), sum(amt3), sum(total)
from tbl_a
However,...
September 27, 2010 at 6:09 am
Is there ever a possibility of circular references?
For example
INSERT @MyRelations
SELECT 'ADF1', 'BFSA9' UNION
SELECT 'BFSA9', 'CAAAAA@AS' ...
September 25, 2010 at 12:05 pm
Declare @sample table (data varchar(30))
insert into @sample
select 'ERC2009Q1' union all
select 'LRC2009Q4' union all
select 'C2009Q3' union all
select 'TRC2009Q2' union all
select 'ETHYR2009Q1' union all
select 'TTSERC2009Q1'
select right('0'+cast(right(data,1)*3 as varchar),2)+'/01/'+left(right(data,6),4)
from @sample
I don't understand why...
September 24, 2010 at 9:09 pm
select max(E) as E
,max(F) as F
,max(G) as G
...
September 24, 2010 at 12:54 pm
Ah... another kilt-wearer heard from. 😀
September 24, 2010 at 12:48 pm
You're welcome. For what it's worth, you should test both of the solutions at production volumes. The ROWNUMBER() solution I gave you has...
September 24, 2010 at 7:36 am
Robert, I am posting this as a public apology. Because the title of your post struck me as an advertisement, I jumped on it and that was rude....
September 24, 2010 at 7:28 am
Tom.Thomson (9/24/2010)
I guess I should use pm and not the thread if I want to start that sort of discussion. Sorry.
Tom, after a good night's sleep and my first...
September 24, 2010 at 7:17 am
Paul White NZ (9/24/2010)
The Dixie Flatline (9/23/2010)
September 24, 2010 at 7:10 am
Chris Morris-439714 (9/24/2010)
The Dixie Flatline (9/24/2010)
Interestingly, Bob's query, while undeniably compact, still scans the source table twice.
You fail to ascertain that performance was not my primary design criterion. 😛
Bob,...
September 24, 2010 at 7:06 am
;with cte as (
select DATEPART(WEEK,CAST(DateID AS varchar)) as [week], -- why is your dateID stored as an int?
DATEPART(YEAR,CAST(DateID AS varchar)) as [year], -- best practice is to name...
September 24, 2010 at 7:00 am
Viewing 15 posts - 1,336 through 1,350 (of 4,081 total)