Databases Reference
In-Depth Information
, @startupParameters
, @systemDbDevice
, @errorLogLocation
, @collation
, @minMemory
, @maxMemory
, @AWEEnabled
, @maxUserConnections
, GETDATE()
, GETDATE()
)
-- If the server already exists in the inventory, perform an update.
ELSE
UPDATE [SQL_Inventory].[dbo].[Servers]
SET [instanceName]
=
@instanceName
,[hostID]
=
NULL
,[clusterID]
=
@clusterID
,[status]
=
@status
,[tcpPort]
=
@tcpPort
,[serverNetworkProtocols]
=
@serverNetworkProtocols
,[type]
=
@type
,[edition]
=
@edition
,[version]
=
@version
,[servicePack]
=
@servicePack
,[startupParameters]
=
@startupParameters
,[systemDbDevice]
=
@systemDbDevice
,[errorLogLocation]
=
@errorLogLocation
,[collation]
=
@collation
,[minMemory]
=
@minMemory
,[maxMemory]
=
@maxMemory
,[AWEEnabled]
=
@AWEEnabled
,[maxUserConnections]
=
@maxUserConnections
,[updateDate]
=
GETDATE()
WHERE instanceName
=
@instanceName and clusterID
=
@clusterID
END
-- If the cluster name is invalid, raise an error and exit.
ELSE
BEGIN
SET @ERRMSG
=
'Upsert failed - '
+
OBJECT_NAME(@@PROCID)
SET @ERRMSG
=
@ERRMSG
+
' Cluster '
+
@clusterName
+
'
does not exist. Please add the cluster first.'
RAISERROR (@ERRMSG, 16, 1)
RETURN (-1)
END
END
SET @ERRORCODE
=
@@ERROR
IF @ERRORCODE <> 0
BEGIN
SET @ERRMSG
=
'Upsert failed - '
+
OBJECT_NAME(@@PROCID)
SET @ERRMSG
=
@ERRMSG
+
' Error Code: '
+
RTRIM(CONVERT(CHAR, @ERRORCODE))
RAISERROR (@ERRMSG, 16, 1)
RETURN (-1)
END
GO
Search WWH ::
Custom Search