using the following query:
SELECT Name, Status FROM dbo.sysdatabases WHERE name IN ( 'db_name' )
I get in some cases status = 24, other times 1024 and other times 65544
I see that even when status is 24 I can open and check content of the database from SQL Management Studio but not from a legacy application which checks status to be at least 1024.
when I ask DBAs to fix this issue they run some magic scripts and status goes up to 65544 and all works fine, I would like to have some names for these statuses not just numbers like 24, 1024, 65544.
I have already checked this link: sysdatabases
which contains this table:
Status bits, some of which can be set by the user with ALTER DATABASE (read only, offline, single user, and so on):
1 = autoclose; set with ALTER DATABASE.
4 = select into/bulkcopy; set with ALTER DATABASE RECOVERY.
8 = trunc. log on chkpt; set with ALTER DATABASE RECOVERY.
16 = torn page detection, set with ALTER DATABASE.
32 = loading.
64 = pre recovery.
128 = recovering.
256 = not recovered.
512 = offline; set with ALTER DATABASE.
1024 = read only; set with ALTER DATABASE.
2048 = dbo use only; set with ALTER DATABASE RESTRICTED_USER.
4096 = single user; set with ALTER DATABASE.
32768 = emergency mode.
4194304 = autoshrink , set with ALTER DATABASE.
1073741824 = cleanly shutdown.
but I don't see 24 and 65544 in there :(