Reputation
84,249
Next tag badge:
87/100 score
26/20 answers
Badges
11 122 232
Newest
 Nice Answer
Impact
~3.4m people reached

11h
comment Migrate existing SQL Server database file to smaller files
Do you have > 1 TB of free space on the current drive?
14h
comment Password generator function
@JGA A function may allow your code to be 20 characters shorter or something in that specific case, but do you get any funny feeling or warning signs about it at all seeing as several people are objecting to your insistence that it be a function? Also I agree with BaconBits above - if you are storing plain text passwords in a table, you have much bigger things to worry about than whether you are doing it with a function or not...
1d
comment Show all stored procedure definitions (content) for editing
Yes, if you right-click and modify, it will load fully intact. If you select object_definition, copy and paste, it won't. Don't use line count as a measurement - you can have a single line with > 8000 characters.
1d
comment Show all stored procedure definitions (content) for editing
@EvilDr Unlikely, I'm using the very most recent version of Management Studio and it still truncates the text, so it's not something that would have been recently fixed.
1d
comment Password generator function
If uniqueness isn't important then you don't have to store a ton of values in the table - 10? 100? Pass through them once, then start back at the top of the list. Some people will care about that 100ms (and I suspect I could demo widening that gap if I had the time or inclination). The nice thing about the table is it can be accessed directly from an inline TVF (and even produce multiple passwords in a single pass, without any calculation at runtime). Anyway my suggestion was just a response to the OP's insistence that he use a function, not a declaration that your solution is wrong or bad.
1d
comment Stored procedure with recompile
@Andomar There's also nothing wrong with replacing my whole car when I get a flat tire. Recompiling the whole procedure for one problem statement is inelegant, wasteful, and loses certain optimizations (see Paul White's post.) Just because Microsoft's documentation correlates the two does not make it the best idea.
1d
comment Show all stored procedure definitions (content) for editing
@EvilDr That's results to grid, which shouldn't be very useful for you since it swaps out things like carriage returns and line feeds for spaces and tabs or something (so that everything can appear on one line). I have the same setting and in both Results to Grid and Results to Text my procedure body was truncated. As for why there was no truncation in your specific case, I don't know. Maybe there is a ton of trailing white space in the procedure body? Maybe it was 4001 characters and the last character was a space?
1d
comment SQL server data copy bug?
What does "manually copying" mean? From where, exactly? To where, exactly?
1d
answered Stored procedure with recompile
1d
comment Show all stored procedure definitions (content) for editing
It's sys.syscomments, not sys.comments, and aside from the problems caused by single objects spanning rows (and the fact that your where clause won't work), it is deprecated and Microsoft says not to use it right at the top of the documentation. Unless you are stuck on ancient versions like SQL Server 2000, there are better, more modern ways to retrieve procedure definitions.
1d
revised Show all stored procedure definitions (content) for editing
added 545 characters in body
1d
comment Show all stored procedure definitions (content) for editing
@Hector Why do you think naïve is a typo?
1d
reviewed Reject and Edit Show all stored procedure definitions (content) for editing
1d
revised Show all stored procedure definitions (content) for editing
added 4 characters in body
1d
comment How can I inform myself that an automatic SQL Server process has worked?
Surely using TRY/CATCH is more straightforward then all this counting work...
1d
revised Show all stored procedure definitions (content) for editing
added 409 characters in body
1d
comment How can I inform myself that an automatic SQL Server process has worked?
Detecting errors is pretty easy using TRY/CATCH. Have you looked into error handling at all?
1d
answered Show all stored procedure definitions (content) for editing
1d
comment How can I inform myself that an automatic SQL Server process has worked?
How do you measure "properly"? We have no idea. Also, this seems like a weird thing to alert on - imagine if the banks sent the police a message every hour saying "not getting robbed"? Your code should be built to determine its own success and to detect and handle errors - get an alert when it breaks, not when it works.
2d
comment Stored procedure with recompile
Also, if many parameters are optional (so the query has things like WHERE col = @param or @param IS NULL), check out the kitchen sink - sometimes dynamic SQL can be a much more effective solution.