Viewing 15 posts - 796 through 810 (of 1,192 total)
The WHERE clause has to precede the GROUP BY clause.
Cheers!
November 10, 2015 at 11:52 am
Jeff Moden (11/9/2015)
Jacob Wilkins (11/9/2015)
November 9, 2015 at 6:22 pm
Keep in mind sp_spaceused doesn't report the size of a clustered index as part of "index_size". If the table in question has (is) a clustered index, and you're trying to...
November 9, 2015 at 3:40 pm
sys.dm_db_index_usage_stats also has information on heaps.
That's easy enough to confirm:
CREATE TABLE MyTemporaryHeap (id int)
--Let's perform a user update
INSERT INTO MyTemporaryHeap
SELECT 1
SELECT last_user_lookup, last_user_scan, last_user_seek, last_user_update
FROM sys.dm_db_index_usage_stats
WHERE database_id=DB_ID() AND object_id=OBJECT_ID('MyTemporaryHeap')
--Now...
November 4, 2015 at 12:49 pm
I'll just throw another +1 to the "I think you should avoid syntax errors". Sure, you could fix the CREATE statements offered, but that's quite a stretch. Even then, "should"...
November 4, 2015 at 8:36 am
Eirikur Eiriksson (11/3/2015)
Further on Jacob's excellent suggestion, check for the existence of the pattern before the substring, as you could have false positives when the pattern is not found.😎
Thanks, good...
November 3, 2015 at 1:26 pm
You can use PATINDEX and SUBSTRING do something like this.
The trick would just be to make sure you've identified a pattern or set of patterns that captures all instances of...
November 3, 2015 at 12:46 pm
Well, just to be clear, there's no way to control the duration of an automatic checkpoint.
For a manual checkpoint, you can specify a target duration. From https://msdn.microsoft.com/en-us/library/ms188748.aspx:
checkpoint_duration
Specifies the requested amount...
October 31, 2015 at 9:46 am
I typically prefer keeping the drives under 2 TB (partially because I work a lot with virtual machines in VMware, and past 2 TB adding space to a drive requires...
October 31, 2015 at 9:34 am
You can just query sys.indexes for that, looking for the object_id of your table, a type=1 (clustered), and is_unique=0.
Something like this:
CREATE TABLE YourTable (ID int)
CREATE CLUSTERED INDEX CI_YourTable_ID ON YourTable...
October 31, 2015 at 9:30 am
If the goal is just to take the employee's original start date, add 20 years, and then add any days they were inactive, then here's another way, using J Livingston's...
October 29, 2015 at 12:26 pm
If I'm understanding this correctly ,that's just because when only 1 row is returned for a LID after the WHERE clause criteria are applied, then the 1-row LIDs trivially have...
October 27, 2015 at 1:47 pm
peter 82125 (10/22/2015)
Thank you all so much for your informative replies! Jacob, you rock, caffeine or none! Really appreciate it 🙂
I'm glad we could help!
October 22, 2015 at 3:56 pm
It may be rather academic, but there is at least one case where EXISTS is nicer than a JOIN.
The potential (emphasis on potential) performance advantage that EXISTS has is the...
October 21, 2015 at 6:21 pm
One way is to CROSS JOIN the users and all possible IDs, and then use NOT EXISTS to only return those possible combinations that don't have a match in the...
October 21, 2015 at 11:54 am
Viewing 15 posts - 796 through 810 (of 1,192 total)