Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

determining DB status from status column 1

Status
Not open for further replies.

stiej

Technical User
Jan 20, 2003
142
GB
Hi,

From viewing the status column in sysdatabases i can determine the status value. However, the DB in question is a DB that is being restored (marked as IN LOADING) should have 32 in the status column, 32 being the value attributed to a DB in loading. I have 48 in there though, i guess that's becasue other bits and bobs in the database properties for the Db have been set skewing the 32 and ending up at being a 48.

So....how can i from any status column value determine whether the DB is marked as in loading REGARDLESSS of any other bits being set?

Do I need to do some binary shifting or some kind of kagic like that, and how do I do that?!!

Many thanks.
 
Yup, binary vector. Complete list can be found with:
Code:
select * from master..spt_values where type = 'D'

You can do simple AND masking (WHERE status & 32 <> 0)... or use (example for current database)
Code:
select DATABASEPROPERTY(db_name(), 'IsInLoad')

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
FANTASTIC! Thanks very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top