cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Anonymous
Not applicable
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
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!
1 REPLY 1
Anonymous
Not applicable
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

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now