here is *hh:mm:ss (* for hrs beyond 99) Test code: DECLARE @s datetime='20110401', @e datetime='20110407 18:30:10' SELECT 'total_worked_time'=...
lol - Frank is a faster typist than I. I might delete my posts...
A shorter version (ran fine on sql2k8 R1 & R2): 'worked_time'=convert(varchar(8),cast(datediff(ss,ON_SITE_INDICATED,ENDED_INDICATED)/86400.0 as...
Assuming that both sql 2k & 2k8 are on the hw/load baseline (equiv hw, same load, et..). My WAG that for this qry 'DISTINCT' in 2k uses hashtable...
datetime is just a float, thus use; 1. cast(cast(getdate() as int) as datetime) <= fast but may not work for all versions or 2....
'..Out to lunch ..' & computation intensive would imply io&cpu bound, along with assumption that the sproc is optimized. Scale db up: *more memory...
pseudo tsql for the given data SELECT customer, trans_date, 'stime'=min(trans_time), 'ftime'=max(trans_time),...
Your question could be alot clearer and helpful if you would include an sample dataset along with expected result. Well, here is my stab at answer...
Here is almost working pseudocode - good lucks: declare @id int, @rep_id rep_id_type , @the_full_report varchar(16384) create table #daily_read_rep...
Oh wait, you don't need the while @end loop either.
don't need @line_count and beside increment @line_count within select is indeterministic. select @the_full_report = isnull(@the_full_report,"") +...
Try: select @the_full_report = case when @line_count = 0 then reptxt_text else ISNULL(@the_full_report,"") + " " + reptxt_text end,
Hi Jamie, How's going at Msft? If the replica is not too busy, you should get back 27mil rows in about 5 to 20 minutes SELECT da.* FROM (SELECT...
use the profiler to detect dead-locks, also look into connection timeout value - possibly that due to contention the sproc's runtime exceed the...
Still, partition is the way to go -> just figure out a decent hash algorithm - says 10 to 20 buckets for that 10millions numbers/names, as long as...
If you want to return rows on maxdate of table T > make sure index start_time column > ... WHERE r.start_time >= (SELECT...
I would guess that data row maybe narrow and barely any rows, so pages aren't packed yet and the system doesn't correctly delineate the diff between...
Statistics won't help much if there are way too many table-scans and cartesian join queries.
Partition each table by created-date or updated-date by year -> btree data/indexes height won't be too bad even for wide-rows. Of course you can...
Separate names with a comma.