Friday 17 July 2009

tasklist and svchost.exe stuff

Came across something that I've often wondered about today.
Why do you always have lots of svchost.exe processes running when you look at task manager?
Well I've just worked out how to find out what they are, which could be very useful in the future if I have to try and fix someones spam-ridden pc again.

The tasklist command prompt tool lists all the running processes on your pc, in a similar fashion to Task Manager, however the strength comes in the parameters you can give it.

typing:
tasklist /SVC

shows the list of processes, with the names of the actual process not just the filename, very useful for identifying unusual processes, it will also tell you what svchost is really running. Useful.

Wednesday 8 July 2009

Updating an SQL Table using a join

Today I needed to update one of the tables in my database replacing the value in one field with a derived value from another table. A quick search on the internet turned up this useful post from Ben Nadel


Essentially the statment required is as follows:

UPDATE A
SET DestinationField = B.SourceField
FROM TableToUpdate A
INNER JOIN TableToReadFrom B
ON A.JoinKey = B.JoinKey