1,565 reputation
618
bio website
location Ukraine
age
visits member for 2 years, 5 months
seen 10 hours ago

11h
comment SQL Server - constraint to prevent overlapping dates
Well, the OP could derive that from the error message itself. The question effectively was "Can I have a(ny kind of) constraint that does so and so?", rather than "Can I use my constraint?".
Jul
14
comment Getting unique names when the IDs are different (DISTINCT ?)
+1, although deriving a table appears to be perfectly unnecessary.
Jul
9
revised How do I go about easy table input without creating an application?
minor rephrasings to avoid possible ambiguity
Jul
8
answered How do I go about easy table input without creating an application?
Jun
18
comment SQL2542N - No match for a database image file was found based on the source database alias
Does it matter that you are running the command from the /data/home/db2inst1 directory while the file you say is located in /home/db2inst1?
Jun
18
comment T-SQL Calculate average value for Duration Field
Strangely, thanks to you I've just discovered that DATEDIFF(SECOND, '00:00:00', Duration) is actually slower than your original suggestion, but replacing the '00:00:00' (a string) with a 0 (an integer) did make it faster (than your method). Don't know why we've got different conclusions. (If this matters, I didn't use a table in my tests, because I only wanted to test the expressions, so I assigned same expression to a variable in a loop and measured the time.)
Jun
18
awarded  Altruist
Jun
18
comment T-SQL Calculate average value for Duration Field
You could just get the difference in seconds between '00:00:00' and Duration instead of all the string manipulations.
Jun
18
revised Sequence is reusing
more formatting refinement
Jun
18
suggested suggested edit on Sequence is reusing
Jun
17
awarded  Investor
Jun
7
revised Why can't I use a CASE statement to see if a column exists and not SELECT from it?
grammar
Jun
6
awarded  Nice Answer
Jun
6
answered Why can't I use a CASE statement to see if a column exists and not SELECT from it?
Jun
6
comment Why can't I use a CASE statement to see if a column exists and not SELECT from it?
@MarkSinkinson: Names are checked after the syntax, but yes, SQL Server does that prior to actually running the batch.
Jun
5
comment Count where two or more columns in a row are over a certain value [basketball, double double, triple double]
TIL: PostgreSQL, like MySQL, permits referencing columns in GROUP BY by aliases or ordinal numbers.
May
30
comment MySQL stores 0.00 as 0?
Do you want it displayed as 0.00? Formatting should be done in the application.
May
23
comment How to Handle TimeZone Properly in SQL SERVER?
Such a toolkit would seem to be a great help for a developer. However, a scalar function is a black box to the query optimiser. It means that when I apply your function to a column, the configuration tables you are mentioning will be hit as many times as there are rows in the result set (assuming I use the function in the SELECT clause only). That doesn't seem a nice perspective in terms of performance. I haven't really tested your toolkit, though, so I can't say for sure, that's just a general concern based on what I know.
May
22
comment How can I minimize the risk of accidentally modifying the wrong database?
You mean that would somehow disable access to more than one server from a single SSMS instance? Or what have I missed?
May
15
comment How to find duration in a dataset
You are defining two identical subselects here. This is where using a CTE is helpful, because you can define your subselect as a CTE once and reference it multiple times (just like a view, except it is accessible in a single statement only). Here's one more example for you, this one illustrating how a CTE is re-used.