Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 server reboot time in tsql?

Author  Topic 

rnbguy
Constraint Violating Yak Guru

293 Posts

Posted - 2007-02-28 : 00:16:24
is there a way to find out when the sql server was last rebooted (or how long its been up) in tsql or command prompt (which I will take into tsql)

ta

Kristen
Test

22859 Posts

Posted - 2007-02-28 : 01:44:02
Its in SQL Server's log file, if that helps

Kristen
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-28 : 02:47:32
came across this recently

SELECT login_time
FROM master..sysprocesses
WHERE cmd = 'LAZY WRITER'

http://www.novicksoftware.com/udfofweek/Vol1/T-SQL-UDF-Volume-1-Number-11-udf_SQL_StartDT.htm


KH

Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-02-28 : 07:07:40
quote:
Originally posted by khtan

came across this recently

SELECT login_time
FROM master..sysprocesses
WHERE cmd = 'LAZY WRITER'

http://www.novicksoftware.com/udfofweek/Vol1/T-SQL-UDF-Volume-1-Number-11-udf_SQL_StartDT.htm


KH





That can be simplified to this:
select min(login_time) from master..sysprocesses

[/code]


CODO ERGO SUM
Go to Top of Page

jsinks
Starting Member

13 Posts

Posted - 2007-02-28 : 08:29:01
But that shows only the activities on the time you use the command...rnbguy Q. is LAST TIME IT WAS REBOOTED

tho i don't know the correct ans aswell!!
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-02-28 : 08:37:09
and MVJ's answer gives you exactly this info.
time the sql server service started.

Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

rnbguy
Constraint Violating Yak Guru

293 Posts

Posted - 2007-02-28 : 18:10:51
thanx guys works
Go to Top of Page

sphadke
Yak Posting Veteran

55 Posts

Posted - 2008-04-16 : 21:25:56
How about this?


select name,create_date
from sys.databases
where database_id = '2'

tempdb is always re-created once the SQL Services are stopped and restarted.


Sachin
Go to Top of Page
   

- Advertisement -