Reputation
24,289
Next tag badge:
486/400 score
62/80 answers
Badges
8 77 146
Newest
 Good Answer
Impact
~400k people reached

1d
comment How to select a column to compare two values in it with AND
Or, equivalently, AND c.reg# IN ('PKR3344', 'WWF1155')
1d
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 **Homework/Research** for future Database Administrator
This question is off-topic here I'm afraid.
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.
Apr
21
comment How do I join these queries into one query?
Where does @tmpPkItemID come from? Why the TOP (1) clauses (without an ORDER BY!) in the first two queries? Are you expecting multiple rows? Edit your question to provide CREATE TABLE statements, sample data INSERT statements, and expected results. Otherwise, this question is just going to get closed and deleted because it is too vague.
Apr
20
comment Why is the transaction log file not truncated though its simple recovery model?
The duplicate Q & A does cover this question. Check log_reuse_wait for example. Perform a checkpoint if necessary and so on. All the details are in the target as far as I can tell.
Apr
20
comment Understanding below execution plan
Well, Mr Patterson effectively answered in comments already, I just felt the question deserved an actual "answer". Thanks though :)
Apr
6
comment Estimated versus actual query plan with function calls
@MartinSmith Pretty sure that's "fixed" (by default) by Query Store. So, fixed for an appropriate value of "fixed".
Apr
6
comment Estimated versus actual query plan with function calls
@usr Not sure. Triggers are an older implementation than functions, so maybe that's part of it. Functions are also less separate - they have a root expression in the calling plan. I agree seeing potential trigger actions could be a useful feature.
Apr
4
comment backup a specific set of tables to be moved to a remote system
bcp can handle the requirements stated above. Books Online and the other links on the accepted answer (for the suggested duplicate) contain more information. Once you understand the bcp options, test them. If you find a specific issue as a result of that testing, either edit this question with more details (ideally with a sample table structure and data file), or ask a new question, as appropriate.
Mar
31
comment Oracle 12c Installation in Windows 7 error INS-30131
Please click the 'checkmark' to mark your answer as "the" answer.
Mar
27
comment Is it possible to get seek based parallel plan for distinct/group by?
Skip Scan Connect Item. Closed as Won't Fix, but that doesn't mean it won't be addressed in future. Just that it probably won't :)
Mar
20
comment MAXDOP not working?
@EdwardDortland I had seen that question before - judging by my upvote - but had forgotten about it. At the time, I didn't answer because the existing one seemed to cover it. If I helped clarify things with this answer, that's a bonus! Thanks for alerting me :)
Mar
20
comment Index Optimization Error in SQL Server 2012
Perhaps relevant: connect.microsoft.com/SQLServer/feedbackdetail/view/497580/…
Mar
8
comment How to optimize a table/db with 200 insert/sec
Please merge your accounts
Mar
2
comment Ola Hallengren Index Optimise Script not Rebuilding Indexes
Possible duplicate of Why not rebuild indexes with page count <1000?
Feb
27
comment Subselect of MAX(Version) takes many minutes, though there are only ~20K records
@DavidKrider Yes sorry I meant to mention that in the answer. I used SQL Sentry Plan Explorer for the screenshots. There is a free version of this very popular plan analysis tool.
Feb
27
comment Why would a query work slower when a where clause is added?
The presence of a filter (or not) affects the way the query optimizer estimates the effect of the TOP. You can use OPTION (QUERYTRACEON 4138) on modern versions of SQL Server to see the effect on the chosen plan by disabling the optimizer's 'row goal' logic. This trace flag is documented, but only really intended for debugging purposes.