1,740 reputation
621
bio website
location Ukraine
age
visits member for 2 years, 10 months
seen 12 hours ago

May
8
comment Get streak count and streak type from win-loss-tie data
+1, I like the trick of using the descending order in LAG to later determine the last streak, very neat! By the way, since the OP only wants team IDs, you could replace FantasyTeams JOIN FantasyMatches with FantasyMatches CROSS APPLY (VALUES (home_fantasy_team_id), (away_fantasy_team_id)) and thus potentially improve performance.
Apr
16
revised Latitude and Longtitude Distance Calculation
more cleanup (typos, formatting)
Apr
16
comment Latitude and Longtitude Distance Calculation
What is your question?
Apr
16
suggested approved edit on Latitude and Longtitude Distance Calculation
Apr
12
revised What steps should I perform to prepare a MDF for distribution as a (mostly) read-only database?
spelling, formatting
Apr
12
suggested approved edit on What steps should I perform to prepare a MDF for distribution as a (mostly) read-only database?
Apr
3
comment Why does SQlite return incorrect sum?
I'm sure SQLite thinks it's correct. Have you tried using a different data type?
Mar
7
revised What are the arguments against or for putting application logic in the database layer?
added one more piece of quote to make it clearer what the bullet options are
Mar
7
suggested approved edit on What are the arguments against or for putting application logic in the database layer?
Mar
7
awarded  Disciplined
Mar
7
comment Can IS DISTINCT FROM be combined with ANY or ALL somehow?
This is definitely much superior to the workaround I suggested, especially with @Erwin's improvement.
Mar
6
answered Can IS DISTINCT FROM be combined with ANY or ALL somehow?
Feb
24
awarded  Yearling
Feb
13
comment Why does query error with empty result set in SQL Server 2012?
@ypercube: Agree, it should fail gracefully either way.
Feb
13
comment Why does query error with empty result set in SQL Server 2012?
Actually, the title of the section where the order of evaluation is specified reads "Logical processing order..." (emphasis mine). Also, they've added this explicit disclaimer: Note that the actual physical execution of the statement is determined by the query processor and the order may vary from this list.
Feb
12
comment Return value formatted similar to if casted as money
TIL: REPLICATE accepts negative lengths (returning NULL as a result).
Feb
11
comment create a batch script on windows that periodically starts a sql function
You may not need any batch file at all. In your Scheduler Task, you can just specify the command line tool you are going to invoke to run your script, with all the parameters necessary. There's no need to write a batch file for a single command like that.
Feb
11
comment create a batch script on windows that periodically starts a sql function
‘but I don't know how to write the script’ – batch file script or SQL script?
Feb
8
comment Does union all have an enforced ordering
If both parts of UNION ALL read the same table and your underlying concern is how to speed up the query, you could try the approach as in this SO answer (of mine). That may not work equally well for UNIONing sets retrieved from different tables.
Feb
7
comment SQL Calculated Field in both SELECT and GROUP BY clause
@11684: Um, that begs too many questions. Perhaps you could just explain what you have in mind? Using some example perhaps? Anyway, by simply aliasing an expression (if that's what you are talking about) you aren't really instructing the interpreter to keep the result for future use.