‎08-06-2010 05:35 PM
‎08-10-2010 05:55 PM
‎08-10-2010 06:02 PM
BullGates wrote:
ok, thanks. But in case of deletion if cascade is on, it will be deleted, right?
‎08-10-2010 05:21 PM
‎08-10-2010 12:39 PM
‎08-09-2010 08:34 PM
USE [Lansweeperdb]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[BBTtblUptimes](
[Computername] [int] NOT NULL,
[LastScanned] [datetime] DEFAULT (getdate()),
[Uptime] [nvarchar](255) NULL,
[UptimeID] [numeric](18, 0) IDENTITY(1,1) NOT NULL,
CONSTRAINT [PK_BBTtblUptimes] PRIMARY KEY CLUSTERED
(
[UptimeID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[BBTtblUptimes] WITH NOCHECK ADD CONSTRAINT [FK_BBTtblUptimes_tblComputers] FOREIGN KEY([Computername])
REFERENCES [dbo].[tblcomputers] ([Computername])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[BBTtblUptimes] CHECK CONSTRAINT [FK_BBTtblUptimes_tblComputers]
Func _RetrieveUptime($s_Machine)
Local $LastBootUp, $LocalDateTime, $sec, $uptime, $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20
Dim $objWMIService, $colItems
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $s_Machine & "\root\cimv2")
If IsObj($objWMIService) Then
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
For $objItem In $colItems
$LastBootUp = WMIDateStringToDate($objItem.LastBootUpTime)
$LocalDateTime = WMIDateStringToDate($objItem.LocalDateTime)
Next
$sec = _DateDiff("s", $LastBootUp, $LocalDateTime)
;$uptime = StringFormat("%.02d" & " " & "%.02d" & ":" & "%.02d", Mod($sec / 86400, 3600), Mod($sec / 3600, 24), Mod(($sec / 60), 60))
$uptime = $sec
$colItems = ""
$objWMIService = ""
Return $uptime
EndIf
EndFunc ;==>_RetrieveUptime
‎08-10-2010 06:14 AM
BullGates wrote:
Lansweeper, can you please point me out how to create this table with cascade active correctly? Thanks.
‎08-07-2010 10:55 AM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now