SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 server reboot time in tsql?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rnbguy
Constraint Violating Yak Guru

293 Posts

Posted - 02/28/2007 :  00:16:24  Show Profile  Reply with Quote
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

United Kingdom
22403 Posts

Posted - 02/28/2007 :  01:44:02  Show Profile  Reply with Quote
Its in SQL Server's log file, if that helps

Kristen
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17440 Posts

Posted - 02/28/2007 :  02:47:32  Show Profile  Reply with Quote
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


Edited by - khtan on 02/28/2007 03:01:58
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

USA
7020 Posts

Posted - 02/28/2007 :  07:07:40  Show Profile  Reply with Quote
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

Go to Top of Page

jsinks
Starting Member

Zambia
13 Posts

Posted - 02/28/2007 :  08:29:01  Show Profile  Click to see jsinks's MSN Messenger address  Reply with Quote
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

Slovenia
11749 Posts

Posted - 02/28/2007 :  08:37:09  Show Profile  Visit spirit1's Homepage  Reply with Quote
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 - 02/28/2007 :  18:10:51  Show Profile  Reply with Quote
thanx guys works
Go to Top of Page

sphadke
Yak Posting Veteran

USA
55 Posts

Posted - 04/16/2008 :  21:25:56  Show Profile  Visit sphadke's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000