SQL upit – ime kompjutera
1) Kako kroz SQL upit dobiti ime kompjutera :
select ServerProperty(‘ComputerNamePhysicalNetBIOS’);
2) I plus dodatne podatke o SQL-u na toj mašini :
select ServerProperty(‘ComputerNamePhysicalNetBIOS’),ServerProperty(‘Edition’);
3) Verzija proizvoda :
select ServerProperty(‘ComputerNamePhysicalNetBIOS’),ServerProperty(‘MachineName’),ServerProperty(‘Edition’),ServerProperty(‘ProductLevel’);
Napomena : prve dve stavke uglavnom daju isti izlaz, pa ja preferiram “MachineName”.
ProductLevel returns Level of the version of SQL Server instance :
‘RTM’ = Original release version
‘SPn’ = Service pack version
‘CTP’, = Community Technology Preview version
4) I na kraju, da bi podaci u kolonama imali lepo svoja imena :
select ServerProperty(‘MachineName’) AS ‘Machine Name’,
ServerProperty(‘Edition’) AS ‘Product Edition’,
ServerProperty(‘ProductVersion’) AS ‘Product Version’,
ServerProperty(‘ProductLevel’) AS ‘Product Level’;
Dobar link sa listom nekih osnovnih veličina dobijenih iz ServerProperty-ja.
Link sa kompletnom listom stavki koje se mogu dobiti iz ServerProperty-ja.
5) I kada skupim sve podatke o SQL-u i o server :
select
cpu_count,
hyperthread_ratio,
[physical_memory_in_bytes]/1024/1024 AS [physical memory MB],
[virtual_memory_in_bytes]/1024/1024 AS [virtyal memory MB],
[bpool_committed]*8/1024 AS [bpool commited MB],
[bpool_commit_target]*8/1024 AS [bpool commited target MB],
ServerProperty(‘MachineName’) AS ‘Machine Name’,
ServerProperty(‘Edition’) AS ‘Product Edition’,
ServerProperty(‘ProductVersion’) AS ‘Product Version’,
ServerProperty(‘ProductLevel’) AS ‘Product Level’
from sys.dm_os_sys_info;