How do I get cpu hardware info using T-SQL

  • I mostly develop on SS2K5 (SP1) using a machine with 4 * 3.4Ghz Xeon CPUs and 4 Gb memory.

    I recently moved a query to one of our corporate machines, which runs SS2K (SP4) and has 2 CPUs and 2Gb memory. The query took 6 minutes instead of 1 minute.

    Running a cpu intensive test to see if I could determine the processor speed (sum squares from 1 to 299,999) took 1 second elapsed, 15 ms cpu, on 'my' machine, but took 139 seconds (!), 4646 ms cpu, on the corporate server.

    Is there a way to actually read the hardware information and find out what the CPU(s) actually are?

    BTW, this was the test

    declare @C int, @m datetime, @kk bigint

    set @m=getdate()

    set @C=@@cpu_busy

    set @kk=0

    declare @s-2 int set @s-2 = 1

    while @s-2 < 300000

    begin

    set @s-2 = @s-2 + 1

    set @kk=@kk+(convert(bigint,@s)*@s)

    end

    print (@@cpu_busy-@c)

    print datediff(ms,@m,getdate())

    print @kk

    Derek

  • How about using VBScript? You can trigger the script from your T-Script.

    http://www.microsoft.com/technet/scriptcenter/scripts/hardware/default.mspx?mfr=true

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply