Reputation
13,329
Next tag badge:
89/100 score
18/20 answers
Badges
5 36 80
Newest
 Taxonomist
Impact
~571k people reached

Feb
1
awarded  Taxonomist
Jan
28
awarded  Nice Answer
Nov
4
awarded  Popular Question
Oct
30
awarded  Popular Question
Oct
5
comment How to avoid deadlocks when running queries on a remote server
The WHERE clause can also cause a key lookup operation (which is basically guaranteed if you use SELECT * and the WHERE is not covered by the CI), and key lookups can lead to deadlocks since it's technically two operations.
Sep
22
awarded  Popular Question
Sep
4
awarded  Great Answer
Aug
4
comment Compound Primary Key - Index both fields?
I disagree that "Index on UserID alone is useless". There are definitely use cases for a narrow NC index that overlaps in part with a wider CI. The narrow NC index will be a LOT faster to do seeks on, especially if you aren't pulling data from the row beyond the userid.
Aug
4
comment How To Manage Random Data Without Repitition?
This is very hard to follow. It should be fairly easy to handle by having a questions table (which you don't seem to list) and a UserQuestions table that you insert into before showing the questions. If UserQuestions has a unique constraint on (UserID, QuestionID) it will be impossible to have the same question for the same user more than once.
Aug
4
comment Real-world scenarios for table with DENY SELECT and GRANT [INSERT/UPDATE/DELETE]
Off the top of my head, I could see a table that you were allowed insert but not select for tracking financial transactions. You may need to log that an expense occurred but not have permission to see everyone else's transactions. Functionally I think this is probably silly since these functions should be encapsulated in stored procedures or UDFs and permissions controlled on those objects.
Aug
4
comment Why does PK constraint require a separate index when I already have a suitable unique clustered index?
@MikaelEriksson it is in other versions of SQL Server
Aug
4
comment Why does PK constraint require a separate index when I already have a suitable unique clustered index?
@ypercube azure does not support heaps apparently: social.msdn.microsoft.com/Forums/azure/en-US/…
Aug
4
awarded  Constituent
Aug
3
comment Select statements during long update
You can also always consider batch updates. If you use a TOP(10000) in the update, it'll just do that many records at once. Do this in a WHILE loop until no rows are updated.
Aug
1
awarded  Nice Answer
Jul
27
awarded  Caucus
Jul
8
answered What is the difference between Used and Allocated space?
Jun
2
comment What is the optimal way to design an approval queue and audit trail for entities in SQL Server 2008 R2?
@AlexandreJobin You need to either filter on the active bit (since only one customer can be active) or have two customerIDs since it's obviously not a unique identifier.
May
27
awarded  Yearling
May
6
comment Replacing a Cursor with a single Query possible?
What RDBMS? In SQL Server this should be easily done with CTEs and windowing functions like ROW_NUMBER().