Friday 5 April 2013

DBA Concepts



How to update statistics which are outdated?
--- updating usage statistics on SQL Server
EXEC sp_updatestats

------------------------------------------------------------------------------------------------------------------------------------------
How to identify the current SQL version on the server?

SELECT
          SERVERPROPERTY('MachineName') as Host,
          SERVERPROPERTY('InstanceName') as Instance,
          SERVERPROPERTY('Edition') as Edition, /*shows 32 bit or 64 bit*/
          SERVERPROPERTY('ProductLevel') as ProductLevel, /* RTM or SP1 etc*/
          Case SERVERPROPERTY('IsClustered') when 1 then 'CLUSTERED' else
      'STANDALONE' end as ServerType,
          @@VERSION as VersionNumber         

------------------------------------------------------------------------------------------------------------------------------------------
How to retrieve the configuration paramaters in SQL Server 2005?

'SELECT * from sys.configurations order by NAME
or
SP_CONFIGURE 'show advanced options',1
go
RECONFIGURE with OVERRIDE
go
SP_CONFIGURE
Go

No comments:

Post a Comment

Check if column exists or not in the SQL server

--method 1 IF EXISTS(SELECT 1 FROM sys.columns with (nolock)           WHERE Name = N'LoginName'           AND Object_ID = Objec...