Reputation
25,104
Next tag badge:
515/400 score
63/80 answers
Badges
9 80 149
Newest
 Steward
Impact
~408k people reached

2d
comment Is there an advantage to not partition aligning an index?
Yes. Choosing a non-aligned index would have to be a very informed choice. I have done it myself (rarely) in the past, but in very specific circumstances where the benefits outweighed the costs.
May
1
comment Can a critical section cause deadlock in SQL Server?
Sequence objects may be an option, but they are not suitable for all cases and have had concurrency problems (bugs) of their own 1 2
May
1
comment Can a critical section cause deadlock in SQL Server?
Just out of curiosity, what do you mean by "critical section" here? I understand the term generally, but wonder how you implemented that in T-SQL.
May
1
comment How to generate documentation from stored procedures?
In response to your opening question, it is possible to read the original question as looking for an external tool recommendation.
Apr
30
comment how to extract an integer from a column having an xml of clob data type?
Your comment on the question says it is SQL Server. Your comment on Spörri's answer says it is Oracle. Please clarify by editing the question and its tags. Also, it is better to edit your question than add new snippets of information in different places.
Apr
30
comment Table-valued Function XML Reader
Appreciate the effort taken to edit the question, but how could we possibly say whether creating an xml index would be effective for you? It might, or it might not. Probably best if you try it?
Apr
29
comment Fastest way to disable indices and drop constraints and rebuild SQL Server table
It might be worth making it clear that ALTER INDEX ALL ... DISABLE will also disable the clustered index.
Apr
29
comment How to remove leading zero from date
Five people with the cast close votes moderation privilege thought this question was too basic or not relevant to most of our audience.
Apr
28
comment Select all records, join with table A if join exists, table B if not
@EBrown No worries. Just to be clear: It is only posted as an alternative - I'm not saying it will always perform better or worse than Aaron's. Thanks for the interesting question.
Apr
28
comment Select all records, join with table A if join exists, table B if not
@EBrown Disregard the percentages. They are internal estimates used by the query optimizer to choose between plan alternatives. They never measure actual performance even in a post-execution ('actual') plan. Measure performance directly. If you have changed the schema yes all bets are off. Feel free to post the execution plan somewhere if you would like an analysis. If you have Plan Explorer, you can use the built-in feature to upload it to the Q & A site there
Apr
28
comment T-SQL insert value based on identity column
@JonofAllTrades Yes I am sure, for example DECLARE @T table (c1 int NULL, c2 AS ISNULL(c1 * 2, 0) PRIMARY KEY);. The computed column needs to be not nullable by inspection - as distinct from requiring a NOT NULL constraint, which would require PERSISTED.
Apr
27
comment What exactly can SQL Server 2014 execute in batch mode?
@usr Yes! I like the LOJ on 0 = 1. Very nice.
Apr
27
comment T-SQL insert value based on identity column
If may be 'obvious' to me and you, but your current answer wording is open to misinterpretation: "Since the Sequence value is already unique (by virtue of being IDENTITY)". My original comment was to encourage you to edit your answer to clarify. It is a common misconception, after all.
Apr
27
comment T-SQL insert value based on identity column
The IDENTITY property does not enforce uniqueness (e.g. reseeding, identity insert) you need a unique constraint or index for that.
Apr
27
comment Query DML code to determine source and target data
This really needs expanding to address more of the question if you want it to stay as an answer. (Answer was flagged as Low Quality, may be deleted as a result).
Apr
24
comment How to select a column to compare two values in it with AND
Or, equivalently, AND c.reg# IN ('PKR3344', 'WWF1155')
Apr
24
comment Receiving the following error in step failure of an agent job:
You don't say what version of SQL Server you are using, but this is most like this bug, which has been fixed in later versions. As a workaround, refactor the option to not aggregate NULLs.
Apr
22
comment Index to filter a view before joining the underlying tables
@NicholasPeterson Pretty much, yes :)
Apr
22
comment Query to get data in one status not in another status
@user3805287 It's not my answer - I just tidied up the formatting. You should thank Stephan :)
Apr
21
comment How to convert timestamp / rowversion to a date and time in SQL Server?
Why not just keep track of the exact date & time the modification occurred in the original table using a trigger? This seems like a bit of an odd idea, to be honest.