
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2008 05:36 PM
Hello,
I was trying my first steps into creating a query to find pc's not restarted in the last 30 days, and I found a problem with Lastbootuptime since it's stored as text, can anyone point me a function to convert the "dbo.tblOperatingsystem.Lastbootuptime" to a valid date (shouldn't it be stored as date instead of text in the table)?
here is what I tried so far:
view name: web30repnotrebooted30days
Thanks!
I was trying my first steps into creating a query to find pc's not restarted in the last 30 days, and I found a problem with Lastbootuptime since it's stored as text, can anyone point me a function to convert the "dbo.tblOperatingsystem.Lastbootuptime" to a valid date (shouldn't it be stored as date instead of text in the table)?
here is what I tried so far:
view name: web30repnotrebooted30days
SELECT dbo.tblComputers.Computername AS Computer, dbo.tblOperatingsystem.Description, dbo.tblComputers.Domain,
dbo.tblOperatingsystem.Lastbootuptime AS [Last bootup]
FROM dbo.tblComputers LEFT OUTER JOIN
dbo.tblOperatingsystem ON dbo.tblComputers.Computername = dbo.tblOperatingsystem.Computername
WHERE (dbo.tblOperatingsystem.Lastbootuptime < GETDATE() - 30)
Thanks!
Labels:
- Labels:
-
Report Center
1 REPLY 1

Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2008 12:51 PM
ok, I think I got it.
CREATE VIEW dbo.web30repnotrebooted30days
AS
SELECT dbo.tblComputers.Computername AS Computer, dbo.tblOperatingsystem.Description, dbo.tblComputers.Domain,
dbo.tblOperatingsystem.Lastbootuptime AS [Last bootup]
FROM dbo.tblComputers LEFT OUTER JOIN
dbo.tblOperatingsystem ON dbo.tblComputers.Computername = dbo.tblOperatingsystem.Computername
WHERE (CONVERT(char(8), dbo.tblOperatingsystem.Lastbootuptime, 120) < GETDATE() - 30)
GO
INSERT INTO [tsysreports] ([Reportquery],[Reporttitle]) VALUES ('web30repnotrebooted30days','Computers without reboot for more than 30 days')
GO
