Saturday, February 25, 2012

OS Service pack

Is there a way from within a SQL Script to determine what OS service
pack is installed other than SELECT @.@.VERSION? I am trying to
automate a script based upon the OS service pack installed (if any),
and having to somehow parse the results of @.@.VERSION seems unreliable.
Any ideas?
Brandon
--
"In the beginning the universe was created. This has made a lot of
people very angry, and has been widely regarded as a bad move." -
Douglas Noel Adams (1952-2001)Have a look at SERVERPROPERTY and xp_msver.
Off the top of my head I think you need to run :- xp_msver windowsversion
--
HTH
Ryan Waight, MCDBA, MCSE
"Brandon Lilly" <brandon.lilly@.nospam_medevolve.com> wrote in message
news:eZw5EB3kDHA.3612@.TK2MSFTNGP11.phx.gbl...
> Is there a way from within a SQL Script to determine what OS service
> pack is installed other than SELECT @.@.VERSION? I am trying to
> automate a script based upon the OS service pack installed (if any),
> and having to somehow parse the results of @.@.VERSION seems unreliable.
> Any ideas?
> Brandon
> --
> "In the beginning the universe was created. This has made a lot of
> people very angry, and has been widely regarded as a bad move." -
> Douglas Noel Adams (1952-2001)
>|||You can get the OS information by running the
xp_msver 'WindowsVersion' extended stored procedure.
Like so...
CREATE TABLE #windows_info
(
idx INT
, name NVARCHAR(128)
, internal_value INT
, character_value NVARCHAR(255)
)
INSERT #windows_info
EXECUTE xp_msver 'WindowsVersion'
SELECT * FROM #windows_info
I don't know if this is easier than parsing the @.@.VERSION
string though.
Tim
>--Original Message--
>Is there a way from within a SQL Script to determine
what OS service
>pack is installed other than SELECT @.@.VERSION? I am
trying to
>automate a script based upon the OS service pack
installed (if any),
>and having to somehow parse the results of @.@.VERSION
seems unreliable.
>Any ideas?
>Brandon
>--
>"In the beginning the universe was created. This has
made a lot of
>people very angry, and has been widely regarded as a bad
move." -
>Douglas Noel Adams (1952-2001)
>
>.
>|||You can get it from the registry, using the undocumented
xp_regread. Try:
exec
master..xp_regread 'HKEY_LOCAL_MACHINE', 'SOFTWARE\Microsof
t\Windows NT\CurrentVersion', 'CSDVersion'
If your OS is NT 4, this won't distinguish between SP6 and
SP6a.
HTH
Vern
>--Original Message--
>Is there a way from within a SQL Script to determine what
OS service
>pack is installed other than SELECT @.@.VERSION? I am
trying to
>automate a script based upon the OS service pack
installed (if any),
>and having to somehow parse the results of @.@.VERSION
seems unreliable.
>Any ideas?
>Brandon
>--
>"In the beginning the universe was created. This has
made a lot of
>people very angry, and has been widely regarded as a bad
move." -
>Douglas Noel Adams (1952-2001)
>
>.
>

No comments:

Post a Comment