Reputation
39,199
Next tag badge:
572/400 score
77/80 answers
Badges
8 104 163
Newest
 Enlightened
Impact
~1.6m people reached

10h
comment T-SQL : Is string a Palindrome?
@MSIS - It's basically the same algorithm as you describe in the question but done in a set based way rather than iterative procedural code.
11h
revised T-SQL : Is string a Palindrome?
deleted 40 characters in body
11h
revised T-SQL : Is string a Palindrome?
added 244 characters in body
11h
answered T-SQL : Is string a Palindrome?
16h
comment Can we commit the transaction when the sql server trigger fails?
Quite likely. I did focus in on that point as it is potentially extremely dangerous.
18h
comment Trim Trailing Whitespace, Tab, Newline, Carriage Returns, etc
@srutzky - Thanks. I've updated the collation I'll leave fixing the specific white space characters as an exercise to the reader.
18h
revised Trim Trailing Whitespace, Tab, Newline, Carriage Returns, etc
added 5 characters in body
21h
comment Can we commit the transaction when the sql server trigger fails?
@PushCode you should heed the warning and not use this approach even though technically it is possible to commit in a trigger. People will legitimately expect that if they issue an explicit begin tran before the insert nothing is going to be committed unless they do so.
1d
comment Do temporal tables log changes when there are none?
For regular tables check the information here by @PaulWhite sqlblog.com/blogs/paul_white/archive/2010/08/11/…. I haven't looked into temporal tables yet. Is there any reason to expect they will behave differently?
1d
comment Can the OUTPUT clause create a table?
There's always the OPENROWSET hack...
1d
revised Slow-running query returns incomplete resultset
added 298 characters in body
1d
revised How can a database parameter be used on `sp_addextendedproperty`?
deleted 78 characters in body
1d
comment List of queries run
"I'm looking for a DMV query for SQL Server 2008 R2 which shows me all queries (full history) run by a specific user." - This doesn't exist out the box. You would need to use tracing, extended events or SQL Audit.
1d
revised Should we still be using QUOTENAME to protect from injection attacks?
added 248 characters in body
1d
comment Slow-running query returns incomplete resultset
The execution plan shows instances of the same tables being accessed repeatedly. (E.g. tblUnitDetail, tblReportDetail and tblReportDaily) quite likely these could be consolidated if you rewrite without the views.
1d
revised Why database snapshot creation is faster than normal database backups?
added 379 characters in body
1d
comment Query against sys.schemas and sys.synonyms runs very slow for one user
@GeoffPatterson - I didn't claim it was negligible, but it would need a lot more calls before I got up to the 3-6 minutes experienced by the OP so it would be interesting to know how many objects they actually have.
1d
revised Why are numbers tables “invaluable”?
deleted 1 character in body
1d
comment Can see other user's databases in shared hosting
Depending on what version of SQL Server they are running it might be trivial for someone to get these names anyway by just trying various integers with the DBNAME function
1d
comment Query against sys.schemas and sys.synonyms runs very slow for one user
@James - I don't see such a pathologically big time difference on my install of 2014 though. On AdventureWorks 2014 I created a query that calls this filter 56,120 times (2,806 * 20) pastebin.com/1EeR1fCi and the difference in execution times is CPU time = 32 ms, elapsed time = 36 ms for dbo and CPU time = 171 ms, elapsed time = 167 ms. for UserB. Using windows perf toolkit shows DBO i.stack.imgur.com/0ezvR.png and UserB i.stack.imgur.com/cJoFS.png - How many rows do you actually have going through the filter?