How can I tell how many physical processors are installed in a machine? I need this information to correctly set SQL Server's max degree of parallelism (MAXDOP) because I don't want the setting to be higher than the number of physical processors.

You're correct in pointing out that the MAXDOP setting shouldn't be greater than the number of physical processors. By default, SQL Server uses the number of available hyperthreaded logical processors in a system, which can lead to performance problems on a busy system because the parallelism code assumes that each task that's broken out to run as a separate step will in fact run on a separate processor. Clearly, contention is more likely to happen if two tasks are fighting for time on the same processor.

Microsoft utilities don't do a good job of letting you see the distinction between physical and logical processors. However, you can use the Intel Processor Identification Utility ( /processors/tools/piu) for this task. I don't have room to describe the utility in detail, but it's pretty straightforward. Intel provides a version of the utility that requires that you reboot the server as well as a Windows-based version that doesn't require a reboot. Needless to say, the latter version is a lot more useable.