I've been using the Query Analyzer that comes with Microsoft SQL Server 2000 since it was first released and just discovered this trick today.
TIP: Query Analyzer - Selective Query ResultsIf you ever wish to run just a subset or portion of a query, highlight the portion of your query you want results for and click the "Execute Query" button (or hitting [F5].) Query Analyzer will then run just the portion of SQL code that's selected and display the results in the Results Grid.
This works great if you want to see what a query is doing without the where clause, or perhaps to see the results of an inner select statement. In the past I was always copying these to a new window to run. No more!
On a site I'm managing, there's a query that was written by another developer that I've been trying to speed up. The query searches over a text column in a MS SQL 2k database. The table this column is in contains several million records and the query performance isn't up to par.
Anyway, I've been trying anything I can think of to increase performance over this query. Oddly enough, in gentle testing using SQL Query Analyzer it was indicating I might get better performance from this operation by spitting thing into two seperate queries. This lead me to find this bug:
My boss wanted to make sure that on one of our servers we were updating our Symantec Anti-Virus definitions on an hourly basis. By default the Symantec Anti-Virus Client will only allow you to do a LiveUpdate once per day. Fortunately, there's a command line tool called VPDN_LU.exe which you can run to do silent updates.
Here are the command line options for the VPDN_LU.exe tool:
I was watching a re-run of The Screen Savers today and they had a guest on who showed off a browser toolbar addon called SpoofStick.
The idea behind this toolbar is that it will resolve the actual website you're on and display the name of the server. Some of you may be thinking: "Why is this useful? When I go to a site I know what site I'm on." Or do you?
One of the most commonly used techniques by hackers attempting to gather person information about users (such as your credit card number or PayPal account,) is to send an e-mail address that looks official which provides a link to "update your personal information." These messages often look legit and the websites they take you too often look they way you'd expect them to—however, they're not actually the official website; it's a copy of the site on a hacker controlled server.
I tend to forget just how many commands are built-in to T-SQL. So often the stuff I do in the database is so basic, that I forget that there are often many different ways to approach the same problem and I often just forget that certain functions even exist.
I was reading through my SQL Server 2000 Unleashed book the other night, and came across the COALESCE() function—one of those functions I had forgetten about. In a nutshell, you can provide the function an unlimited number of arguments and the first argument which isn't equal to null will be the value return from the function. The funny thing is, I had been trying to debate on the best method to re-write a particular stored procedure and the COALESCE() ended up being a very elegant solution.
The problem I was faced with, is I wanted to write a single stored procedure that I could use to update any single column or combination of columns based upon the primary key. In the past, I've always just written out a nasty looking string and then passed that to the execute command or the sp_executesql stored procedure that's included in SQL Server.