-->
SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

SQLStudies

My name is Kenneth Fisher and I am Senior DBA for a large (multi-national) insurance company. I have been working with databases for over 20 years starting with Clarion and Foxpro. I’ve been working with SQL Server for 12 years but have only really started “studying” the subject for the last 3. I don’t have any real "specialities" but I enjoy trouble shooting and teaching. Thus far I’ve earned by MCITP Database Administrator 2008, MCTS Database Administrator 2005, and MCTS Database Developer 2008. I’m currently studying for my MCITP Database Developer 2008 and should start in on the 2012 exams next year. My blog is at www.sqlstudies.com.

Archives: September 2015

Updating a view

I was recently asked how to update views. Specifically the question was about using triggers to update a view.

So updating a simple view is easy enough. Per BOL:

Updatable Views
  • You can modify the data of an underlying base table through a view, as long as the following…

Read more

2 comments, 2,605 reads

Posted in SQLStudies on 30 September 2015

SSMS Connection Information

If you work with a number of different instances and have lots of connections open in Management Studio (SSMS) it can be kind of hard to remember which connection is which. Fortunately all of the information you need is readily available.

Connections in the Object Explorer

Notice that for each… Read more

0 comments, 1,835 reads

Posted in SQLStudies on 28 September 2015

“sql_handle” is not a recognized table hints option.

I’ve you’ve run a query similar to the following:

SELECT *
FROM sys.dm_exec_requests
CROSS APPLY sys.dm_exec_sql_text(sql_handle);

And gotten an error similar to:

Msg 321, Level 15, State 1, Line 9
“sql_handle” is not a recognized table hints option. If it is intended as a parameter to a table-valued function or…
Read more

0 comments, 489 reads

Posted in SQLStudies on 23 September 2015

Zombie AD Groups

I spent something like 2 hours today trying to figure out how a particular user had access to one of my databases. It’s one of the strangest things I’ve ever seen while playing with SQL Server security. Here’s how it plays out:

You have a windows group called [Kenneth-Laptop\Dwarf] with… Read more

4 comments, 357 reads

Posted in SQLStudies on 21 September 2015

Using @@ROWCOUNT can be a bit tricky

@@ROWCOUNT is a very useful system variable that returns the number of rows read/affected by the previous statement. It’s frequently used in loops and in error handling.

TL;DR Store @@ROWCOUNT into a variable immediately after the command you are interested in to persist the value for later use.

So why… Read more

2 comments, 419 reads

Posted in SQLStudies on 16 September 2015

What SQL Server components are installed on this machine?

Figuring out what components of SQL Server are installed on a particular machine has always been a task that has aggravated me. Telling what services have been installed is pretty easy, discovering if the backwards compatibility components were installed, for example, is a bit more difficult. Well recently I found… Read more

2 comments, 401 reads

Posted in SQLStudies on 14 September 2015

Finding the worst running query in a stored procedure

The other day I was asked to tune a stored procedure. Not exactly an uncommon task, but I worked something out in the process. I typically want to start by determining what the slowest part of the SP is. Normally I use sys.dm_exec_query_stats and run a query something like this: Read more

10 comments, 3,903 reads

Posted in SQLStudies on 10 September 2015

Where you should start when managing an enterprise

This T-SQL Tuesday we are hosted by one of the DBA’s of the night: Jen McCown (b/t). She want’s us to talk about Strategies for managing an enterprise. Honestly, had I know she was hosting I probably would have seen this one coming since she and… Read more

0 comments, 1,612 reads

Posted in SQLStudies on 8 September 2015

Learning Regular Expressions

I’m a regular watcher of the Midnight DBA Webshow and one day they mentioned regular expressions. Not a new term for me, but not something I’d ever looked at much. Well as it happens I had something that I needed to use it on a day or two later and… Read more

7 comments, 518 reads

Posted in SQLStudies on 2 September 2015