determine sql server patch level via script


via sql server query analyzer how can I using a script determine the version of patch level sql server is on?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Aneesh RetnakaranDatabase AdministratorCommented:
Hi rutgermons,
if you are looking for the SP then
select @@version will help you

Aneesh RetnakaranDatabase AdministratorCommented:
 No SP
(RTM or Golden) SP1 SP2 SP3 / SP3a SP4 SP5 SP5a
SQL Server 6.0 6.00.121 6.00.124 6.00.139 6.00.151        
SQL Server 6.5
(Hydra) 6.50.201 6.50.213 6.50.240 6.50.258 6.50.281 6.50.415 6.50.416  
SQL Server 7.0
(Sphinx) 7.00.623 7.00.699 7.00.842  7.00.961 7.00.1063    
Use this
Guy Hengel [angelIII / a3]Billing EngineerCommented:
a more precise option:
select serverproperty('Edition') as [Edition]
  ,serverproperty('Engine Edition') as [Engine]
  ,serverproperty('Product Version') as [Version]
  ,serverproperty('Product Level') as [Level]
rutgermonsAuthor Commented:
it gives me only Edition as an output i.e Enterprize Edition

the rest null,could you pls be as kind as to advise

Guy Hengel [angelIII / a3]Billing EngineerCommented:
seems the documentation has a bug, there are no spaces in the strings:

select serverproperty('Edition') as [Edition]
  ,serverproperty('EngineEdition') as [Engine]
  ,serverproperty('ProductVersion') as [Version]
  ,serverproperty('ProductLevel') as [Level]

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.