Hey guys,
A question about database status !
I would like to do 2 checks through T-sql :
* Check if a database exists in my Sql Server
- I found following T-Sql code and it does the trick, so no problem here I guess :
Code Snippet
select * from sys.databases where name = 'Testing'* Check if the database is Online or Offline
Here I'm having trouble selecting a good approach.
At first I would just launch a query to one of my tables, but it got me thinking, this would create a timeout if the database is offline, not ?
So how could I avoid this timeout ? I found out that the SysDatabases table has a status field I can query, but I can't find any document reference for the difference in Status Online or Offline ( I see a change when I do the test local, but I can't get a int reference to really check the value ).
NOTE : I'm on sql 2000 !
So any suggestions ?
Hey Depechie,
check out this tip: http://www.mssqltips.com/tip.asp?tip1033
success,
hansco
No comments:
Post a Comment