Viewing 15 posts - 6,061 through 6,075 (of 7,608 total)
Maybe this; not 100% sure of the final output you want to see:
select x.guid, x.max_intime, x.max_outtime
from
(
select guid,
max (case when gatestatus = 1 then Gatetime else...
May 20, 2014 at 1:13 pm
Here's another version. It uses no extra tables and makes no assumptions: start date and/or end date can be on a weekend, and all SQL settings, including language, are...
May 19, 2014 at 5:04 pm
At a minimum, you need to look at missing index stats and usage stats. (Beyond min, you would include sys.dm_db_index_operational_stats.)
Below are queries that will list what you...
May 19, 2014 at 11:03 am
Look for triggers on the underlying tables. For example, some locations prefer so-called "soft deletes", where the row is never actually deleted, but instead a "deleted" flag gets set....
May 19, 2014 at 10:57 am
SQL always interprets format 'YYYYMMDD' correctly, regardless of SQL settings:
, @start='20140426 00:00:00',@end='20140607 00:00:00'
May 19, 2014 at 10:55 am
Under "sys.dm_db_partition_stats" in Books Online:
"
Requires VIEW DATABASE STATE permission to query
"
May 15, 2014 at 10:40 am
GilaMonster (5/14/2014)
ScottPletcher (5/14/2014)
Besides, for two params do I then have 4 separate procs, for 3 parameters I have 8 separate procs, ...?
No, that would be silly. Dynamic SQL works excellently...
May 14, 2014 at 1:22 pm
That's not for me. I don't like the maintenance pain of "separate but equal" procs. Besides, for two params do I then have 4 separate procs, for 3...
May 14, 2014 at 12:26 pm
ChrisM@Work (5/14/2014)The execution plans for those two queries is likely to be completely different. If you were to write the query as a single "catch-all" query, it would be optimised...
May 14, 2014 at 9:04 am
What is the clustering key on the table?
May 14, 2014 at 8:30 am
If you just want the total hours, you don't need to return all the rows at all, simply total the time differences. This is very easy if there are...
May 14, 2014 at 8:29 am
In the Stores table, use a function to compute a persisted column that is the store name with all non-alphabetic characters stripped. Do the comparisons on that column, but...
May 14, 2014 at 8:25 am
To make sure you don't get a really poor plan, force SQL to recompile the query:
SELECT p.ProjectID, p.ProjectName, p.ProjectDescription
FROM tbl_Projects p
WHERE
p.ProjectID = @ProjectNumber
OPTION(RECOMPILE)
May 14, 2014 at 8:20 am
What is the clustering key on the table?
Can you determine a range of clustering key values for the rows you want to DELETE?
May 14, 2014 at 8:17 am
Full-text indexing would likely help you the most here.
May 13, 2014 at 4:45 pm
Viewing 15 posts - 6,061 through 6,075 (of 7,608 total)