T-SQL Tuesday #025 – Tips and Tricks
As I sit down to write this months T-SQL Tuesday post, I’m finding it hard to figure out what exactly qualifies as a ‘trick’ that I use. When you think about it, something that you use on a regular basis or almost habitually doesn’t just pop into your mind that quickly.
For instance, using ‘select top 10 * from Person.Contact’ gives you a quick list of all the fields, as well as a quick example of what you can find in those fields. But is it really a trick? Hopefully someone reading this will think so. If you haven’t installed SSMS Tool pack, you may want to take a look. Some wonderful shortcuts, practically built into SSMS. For example ‘SST’, which will insert a ‘select top 10’ generic code right into your window, without you having to type it out, as well as a whole gambit of other nice ‘toys’.
What about using ‘activity monitor’ in SSMS? Whenever my accounting department complains about timeouts or it being slow, its the first place I run to. Filter out system processes, and set blocking types to not be all, and viola, instant info about who and what is causing issues for you? In my case it is usually two users that happen to be using similar processes at the same time (vendor database, I can only do so much!). From there I can contact a user, and see if they are hung up and then decide from there how to fix it. Double click on a line, and it will show you what the sql statement run was. Read more about it here.
Or what about something like sp_select as a shortcut in SSMS (compliments of Olga Klimova on SQL Server Central). Is this a trick that I use? Daily. Almost second nature. Olga explains all about it here so I won’t go too deep. Just highlight a table name, and hit the quick key you have set up in SSMS, and boom, top 10! She sets it up w/ top 50, but for the size of my databases, I just do a 10. Great stuff!
I hope I have shown you something that you can use. If you have stumbled across me, please take the time to see what ‘Tsql Tuesday’ is all about by clicking on the TSQL Tuesday logo at the top. Thanks.
‘If your goals don’t scare you, they aren’t worth it…’ – Unknown