Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-11-06 : 07:59:29
|
Nihat writes "How can i get sql server processor_ID or HDD_ID with sql command?thanks..." |
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-11-06 : 08:04:58
|
you mean @@spid?Select @@spid?Chiraghttp://chirikworld.blogspot.com/ |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-11-06 : 09:47:42
|
quote: Originally posted by chiragkhabaria you mean @@spid?Select @@spid?Chiraghttp://chirikworld.blogspot.com/
Wouldn't @@spid be Process ID, not Processor ID?CODO ERGO SUM |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2006-11-07 : 16:06:44
|
This works:create table #a(a varchar(8000) null)exec master..xp_cmdshell 'wmic cpu>c:\cpu.txt'bulk insert #a from 'c:\cpu.txt'declare @start int, @finish intselect @start=charindex('ProcessorId', a), @finish=charindex('ProcessorType',a) from #a where a like '%ProcessorType%'select distinct substring(a, @start, @finish-@start) ProcessorID from #a where a not like '%ProcessorType%'drop table #aWMIC is a neat little command-line utility for WMI stuff. I'll leave it as an exercise for the reader to get the hard drive IDs. |
|
|
|
|
|