Use Transact-SQL to calculate the number of SQL Server processors

Source: Internet
Author: User
Question: How can I use Transact-SQL to determine the number of processors on my SQL Server computer programmatically?
Answer:: The following statement returns the required information:

EXEC master .. xp_msver N 'processorcount ',
N 'processortype'


However, I am keen to teach people how to fish, rather than giving them a plate of frozen fish, so I am not satisfied with the simple answer. Recently, a colleague asked me this question. I couldn't think of the appropriate command at the moment, but I know that the SQL Server Enterprise Manager displays the number of processors on the processor tab of the SQL Server properties dialog box. In addition, the enterprise manager can obtain almost all required information by running simple Transact-SQL statements on the server. In addition, you can run the SQL event probe to quickly view statements generated by the enterprise manager.
I often count the benefits of using SQL event probes and observing SQL Server running conditions. The following is another example of how to implement this suggestion. With the SQL event probe, I took only three minutes to separate the calling of the xp_msver extended stored procedure by the enterprise manager. In this case, I always think about the SQL event probe first.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.