SQL Server Field Notes by Jeff Iannucci

Month: January 2022

sp_GetRowcount: How to count the number of rows in any SQL Server table fast

Have you ever had to find the number of rows in a user table, and then wrote a little “SELECT COUNT(*) FROM tblWhatever” and hit execute…and waited…and waited…and waited some more? And then started wondering what was going on?

If so, this post is for you.

Let me explain the problem, and then give you a reusable solution. Consider this a turning point in your career.

How to tell if Change Data Capture (CDC) is working as expected

I’m not sure how many of you use Change Data Capture (CDC) on your instances, but I’ve had to support it for a while now and I thought I’d share a little script I use fairly frequently to help troubleshoot the capture and cleanup, as well as some advice for resolving issues.

Sharing is such a gentle trait.

#TSQL2sday – Preconceived Notions About Who Is Smart

For this month’s #TSQL2day, Andy Yun asked folks to share about “something you’ve learned, that subsequently changed your opinion/viewpoint/etc. on something.”

Now, there are technical subjects I could share where I’ve changed my opinion, but in thinking about possible answers I realized all of them start with one thing that has changed: who I thought was “smart”.

I put the word smart in quotes, because it’s a totally subjective and ever-changing opinion. Let me show you what I mean.

What permissions are required for temporary tables?

Managing permissions is a constant issue for Database Administrators, but rarely do DBAs consider permissions for tempdb. Everybody’s looking for something, but how often do you get requests for “access to read and write in the tempdb database”? Like…never?

OK, but what if you were asked the subject of this post in a job interview? Even if you’ve worked with SQL Server for ages, would you know how to answer this? Moreover, would you know why the answer should give you some concern?

Hold your head up, because I’ll start answering these questions now.

Powered by WordPress & Theme by Anders Norén

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close