DECLARE @CPUNameString varchar(100)
EXEC master..xp_regread
@rootkey='HKEY_LOCAL_MACHINE',
@key='HARDWARE\DESCRIPTION\system\Centralprocessor\0',
@value_name='ProcessorNameString',
@value = @CPUNameString OUTPUT
SELECT @CPUNameString
The problem is when some of our servers don't have the "cpunamestring" value
under the \0 key, the above query returns error:
Msg 22001, Level 1, State 22001
RegQueryValueEx() returned error 2, 'The system cannot find the file
specified.'
I seem to be unable to get rid of the error message. Anyone got an idea how
to prohibit the error message while running the store dproc?
Your advice is appreciated.
Richard
Anyway, here is how you would do it.
DECLARE @CPUNameString varchar(100)
EXEC master..xp_regread
@rootkey='HKEY_LOCAL_MACHINE',
@key='HARDWARE\DESCRIPTION\system\Centralprocessor\0',
@value_name='ProcessorNameString',
@value = @CPUNameString OUTPUT,
@no_output = 'no_output'
SELECT isnull(@CPUNameString,'RegVal not found.')
--
-oj
RAC v2.1 & QALite!
http://www.rac4sql.net
"Richard Ding" <di...@cleanharbors.com> wrote in message
news:uqWzeA3C...@TK2MSFTNGP11.phx.gbl...
I know this is not documented or supported by MS. I've been searching google
for a while but haven't seen anyone mentioned @no_output. Do you have a
reference or a link to this one?
Richard
"oj" <nospam...@home.com> wrote in message
news:Ocdu7N3C...@TK2MSFTNGP11.phx.gbl...
no, i don't recall seeing any links out there for this flag. if you want to
learn of undoc stuff, you might want to start reading ALL system procs.
--
-oj
RAC v2.1 & QALite!
http://www.rac4sql.net
"Richard Ding" <di...@cleanharbors.com> wrote in message
news:u2tEaT3C...@TK2MSFTNGP10.phx.gbl...
--
- Anith
( Please reply to newsgroups only )
--
-oj
RAC v2.1 & QALite!
http://www.rac4sql.net
"Anith Sen" <an...@bizdatasolutions.com> wrote in message
news:ehIGlu3C...@TK2MSFTNGP10.phx.gbl...
"Anith Sen" <an...@bizdatasolutions.com> wrote in message
news:ehIGlu3C...@TK2MSFTNGP10.phx.gbl...