Reputation
25,462
Next tag badge:
531/400 score
63/80 answers
Badges
9 83 152
Newest
 Enlightened
Impact
~430k people reached

15h
comment Merge row size overflow in SQL Server
This question is unanswerable without a complete repro. The storage engine doesn't make mistakes around row size, so the error has a precise cause. We can't tell you exactly what the reasons are in detail without a repro.
May
9
comment Is it possible to change the default style used by CAST/CONVERT when converting DATETIME?
Suggestion: maybe use SQL_VARIANT_PROPERTY(<column>, 'BaseType') instead of ISDATE(CONVERT?
May
7
comment how to join one select statement to another pivot select statement
Yeah the code formatter struggles sometimes with long lines of text.
May
6
comment how to join one select statement to another pivot select statement
Original formatting didn't render properly. Did my best to fix it up. Feel free to rollback or amend as necessary.
May
2
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
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
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 :)