812 reputation
111
bio website
location Ukraine
age
visits member for 1 year, 3 months
seen 2 days ago
stats profile views 39

Nov
12
comment How much work actually happens on SSMS and how much on the server itself?
@Akash: The server processes the entire batch of instructions sent to it. Therefore, it would initiate all the inserts within the course of execution of the query. But there's also such a setting as NOCOUNT. It controls whether a DML statement sends a tiny report on the number of rows affected back to the client, and the setting is off by default, meaning the reports will be produced. Two million such reports will likely affect the overall execution time of your query considerably, so you might want to issue SET NOCOUNT ON somewhere before the loop (if looping is unavoidable, of course).
Nov
11
comment Case style of tables and field (Naming Conventions)
There might be a general agreement on what to avoid using, though (like e.g. aAAAbBBB, perhaps).
Nov
11
comment Case style of tables and field (Naming Conventions)
In my opinion, there can be no objectively best practice with regard to object naming. Conventions, company policies, yes, a universally best choice, no.
Nov
10
revised how to calculate difference of first row and last row fields value in each group
fixed minor mistakes
Nov
10
answered SUM and JOIN SELF
Nov
10
revised Implications of Changing to a Static Port
fixed grammar and punctuation
Nov
10
suggested suggested edit on Implications of Changing to a Static Port
Nov
10
answered Help with the query
Nov
10
answered Help with the query
Nov
10
revised how to calculate difference of first row and last row fields value in each group
added the assumed interpretation of "first" and "last" used in the answer
Nov
10
revised how to calculate difference of first row and last row fields value in each group
added SQL Fiddle links
Nov
10
revised how to calculate difference of first row and last row fields value in each group
fixed mistakes in queries
Nov
10
comment how to calculate difference of first row and last row fields value in each group
That would work if min values corresponded to min dates, and same for max ones.
Nov
10
answered how to calculate difference of first row and last row fields value in each group
Oct
2
comment Count consecutive null rows from a joined table
@RolandoCruz: Seems probable. Not sure, however, what index or indices to suggest in this situation to make sure they would be efficiently used (not very good at query tuning yet, sorry). If I had to tune this myself, I'd likely be taking into account the GROUP BY columns as well as the ORDER BY ones, although either would seem to me a tricky bit to account for, as those columns belong to different tables.
Sep
28
revised Query from database
improved formatting
Sep
27
suggested suggested edit on Query from database
Sep
27
revised How can I improve this query
incorporated the DDL and the Explain output from Pastebin; added missing capitalisation
Sep
27
suggested suggested edit on How can I improve this query
Sep
27
comment Difficult categorising of rows
If Rebook (type = 5) is a subcategory of Chargeable (type = 3), does that mean that a TaskID can be assigned more than one type (3 and 5 in this case)?