SQL Server
Set based random numbers George Mastros points out that generating a random number using RAND() in a set-based operation will always return the same value for every row in the result set. What’s a DBA to do? Luckily, George also covers a great way to get around this predicament.
Hardware for SQL Server 2008 Andrew [...]
I finally got sick of not having a calendar table, so I went ahead and made one today. It’s nothing special and it really didn’t take much time, but I thought I would go ahead and share my script in the hopes that google will index it and somebody won’t have to think about it:
CREATE [...]
I have to run similar code on a regular basis, so I thought I would share it with everyone.
Basically, it grants access on every stored procedure that meets a certain naming pattern to a single user.
– I’ve updated this with Aaron Bertrand’s suggestions from the comments.
– Thanks to Aaron for helping make this better!
DECLARE @sql [...]
Let’s suppose for a minute that you want to retrieve the top x number of rows from any given query. Keep in mind that x is a value that your users can supply.
Sure, you could do string concatenation and EXEC sp_executesql ‘SELECT TOP ‘ + @count + ‘ x FROM y;’. But, then again, a [...]
SQL Server
Top 10 Interview Questions to Ask Senior DBAs Brent Ozar poses some great questions to ask DBAs (and that you might be asked as a DBA) during an interview. These are the good kind of interview questions, not the “how would you do XYZ” kind of questions. (My default response to the XYZ questions [...]