Sql version and service pack

Configurare noua (How To)

Situatie

Mai jos aveti o procedura care rulata pe serverul de sql returneaza numele serverului, versiunea de sql instalata pe server, ultimul service pack de sql instalat precum si ultimul restart al serverului de sql.

Solutie

create procedure SqlServer_prc

as

declare @LastRestart datetime
select @LastRestart = create_date from sys.databases where database_id = 2

SELECT
@@servername as ServerName,

substring(@@version,1,charindex(‘-‘,@@version)-1)
+convert(varchar(100),SERVERPROPERTY(‘edition’)) ServerEdition,
convert(varchar(100),SERVERPROPERTY(‘productlevel’)) as ServicePack,
@LastRestart as LastRestart

Tip solutie

Permanent
Etichetare:

Voteaza

(21 din 43 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?