Reputation
31,513
Next tag badge:
486/400 score
71/80 answers
Badges
8 79 132
Newest
 Enlightened
Impact
~930k people reached

Mar
6
comment SQL Server: Recursive dynamic SQL puzzle
@user16484 the KB article only mentions order by but the responses on the connect site indicate this is not supported or guaranteed ever. Some example quotes here stackoverflow.com/a/15163136/73226 especially Even without ORDER BY, we do not guarantee that @var = @var + will produce the concatenated value for any statement that affects multiple rows. The right-hand side of the expression can be evaluated either once or multiple times during query execution and the behavior as I said is plan dependent.
Mar
6
comment Average of a row or record across three columns
@shrx no sorry. I have rarely used sqllite.
Mar
5
comment Cursor doesn't print text when I tell it to
Yes you can. screenshot of it all working fine
Mar
4
revised What's the difference between a temp table and table variable in SQL Server?
added 448 characters in body
Feb
28
comment PostgreSQL 9.x: a clustered index on column A is the same as creating a table ordered by A?
@ErwinBrandstetter juggling, sleight of hand, trickery apparently!
Feb
25
comment Create database unique Surrogate Keys without using GUID’s
On 2012+ you could use a sequence object if I understand you correctly. Why do you need this?
Feb
25
comment Check if query will cause duplicate row
Trailing spaces aren't significant and you don't need the join. The example 2 can be simplified to WITH cte AS (SELECT ROW_NUMBER() OVER (PARTITION BY LTRIM(PK) ORDER BY LTRIM(PK)) as rn FROM tab) DELETE FROM cte where rn > 1;
Feb
23
awarded  Enlightened
Feb
23
awarded  Nice Answer
Feb
10
comment How to combine date and time to datetime2 in SQL Server?
SELECT CONVERT(DATE,'2015-02-06',120)+ CAST('23:59:59.999' AS TIME) gives "Operand data type date is invalid for add operator." for me. On 2012.
Jan
23
awarded  Notable Question
Jan
20
revised Is table aliasing a bad practice?
added 138 characters in body
Jan
18
comment Design: how to store lots of booleans?
What RDBMS are you using? What type of queries do you need to do against this data?
Jan
17
comment Update all rows
As far as I understand it adding a new not null column with a default is a metadata only change in Oracle. I doubt they will have optimised the "update all rows to the same value" case. Is this a common operation for you?
Jan
16
comment find all numbers that appear at least three times consecutively
MySql doesn't support windowed aggregates.
Jan
15
comment Would it be better for query plans to be split by statement for re-usability?
dbid and objectid both have is_cache_key=1 so you won't get any reuse of plans between different compiled objects.
Jan
14
awarded  Nice Question
Jan
13
awarded  Famous Question
Jan
13
revised meaning of ## in SQL Server Profiler trace data
added 10 characters in body
Jan
12
reviewed Approve Distinct count of 5 different fields based on multiple values?