Home Forums SQL Server 2005 Administering Does anyone know of a way to get the machine's processor name from T-SQL? RE: Does anyone know of a way to get the machine's processor name from T-SQL?

  • JunkIt (7/29/2014)


    I'd like to retrieve the processor name (the same that name that shows up in the system properties control panel applet)

    I was able to get this code to work but I'd rather not use xp_regread if there is a better way:

    DECLARE @Key_Value nvarchar(4000), @rc int

    EXEC @rc = master.dbo.xp_regread 'HKEY_LOCAL_MACHINE'

    , 'HARDWARE\DESCRIPTION\System\CentralProcessor\0'

    , 'ProcessorNameString'

    , @Key_Value OUT

    , N'no output'

    Returns:

    Intel(R) Xeon(R) CPU E7330 @ 2.40GHz

    Why do you want to do this in sql? Why not just store the name in a table. It isn't like that value is going to change all the time. 😉

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/