Reputation
Next tag badge:
503/400 score
72/80 answers
Badges
8 84 145
Newest
 Enlightened
Impact
~1.1m people reached

Apr
6
comment Shorthand for on primary key?
No, there is no such syntax.
Apr
6
comment SQL queries failing, Memory not releasing
"queries begin to fail" in what way?
Apr
6
comment Estimated versus actual query plan with function calls
@usr - Maybe because the actual cached plan that is selected can vary dependant on the actual number of rows as described here? technet.microsoft.com/en-us/library/…
Apr
6
comment SQL Server index causing incorrect behavior on cursors
@max you're responsible for avoiding the issue yourself with dynamic cursors. See this section by Ken Henderson books.google.co.uk/…
Apr
5
comment Inner Join and Right Join same query
This returns 1 and 2 SQL Fiddle
Apr
5
revised Inner Join and Right Join same query
added 25 characters in body
Apr
5
comment SQL Server : Index Seek with very high Scan Count
Please show the exact query, the table definitions, number of rows in both tables and the execution plan.
Apr
5
comment SQL Server : Index Seek with very high Scan Count
stackoverflow.com/a/21778788/73226
Apr
3
comment Guid vs INT - Which is better as a primary key?
Makes sense!...
Apr
3
comment Guid vs INT - Which is better as a primary key?
What value does the GUID give if the id already is sufficient for humans to identify a row?
Apr
3
comment SQL server deadlock graph explained
Is there a foreign key between text and page_item? Presumably currently these statements are all running in a transaction. Can you remove that so they run in separate transactions?
Apr
1
answered Creating a constraint
Apr
1
comment How to re-declare T-SQL variables if it already exist?
GO is understood by the client tools (that parse and split into batches) not SQL Server itself.
Mar
31
comment Any tips to watch out for when setting one of my databases to Read Only?
Statistics are only auto created or auto updated when a query needs them. If you happen to be running queries against the read only version that are different from what it previously saw and for which no statistics are available or for which the stored statistics were already stale it won't be able to create/update them.
Mar
31
comment Any tips to watch out for when setting one of my databases to Read Only?
Readonly databases prior to 2012 can't auto create or auto update stats so you might want to ensure that stats are manually updated (and potentially any missing ones created) first to avoid sub optimal plans.
Mar
31
comment In SQL Server would misc pages be pushed out when an object grows within a mixed extent?
If Object B grows it will get allocated 6 more pages in other, different, mixed extents. Then when the ninth page was needed a uniform statement will be allocated. I can't imagine there is much milage in trying to "optimise" this aspect either though. Even if your 1,000 objects were all one page and occupying full extents such that 7/8 pages in each were unused you would only be wasting 55MB
Mar
31
comment How is the B-Tree created for a composite PK?
The index is logically ordered in exactly the same order as an ORDER BY PersonID, PersonAge would give. So PersonAge only makes any difference to ordering where rows are tied with the same id.
Mar
29
comment Reset IDENTITY value
I assume you mean in SSMS. This will create a new table, copŷ all rows into it, drop the old table and rename the new one. And you need to do this twice to toggle the datatype back. It is using a sledgehammer to crack a nut.
Mar
27
comment sql querying for a pattern
@AaronBertrand - Thanks!
Mar
27
revised sql querying for a pattern
added 29 characters in body