question

Maxcoder avatar image
Maxcoder asked

Suspect Question

Hi, I am created a new data. I writing a query as "select status from sysdatabases where name= 'db_name'" I am receiving the following result. "665526" But, this result must be is "1077936153". sp_configure 'allow updates',1 Reconfigure WITH OVERRIDE After writing ; update sysdatabases set status = 32768 where name='db_name' it's not updating.What's the problem here? thanks in advance.
sqlsql-server
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ThomasRushton avatar image ThomasRushton ♦♦ commented ·
What are you trying to achieve? Why are you doing it this way, rather than using ALTER DATABASE? More details required!
1 Like 1 ·
Grant Fritchey avatar image Grant Fritchey ♦♦ commented ·
Yeah, I'm confused by what we're trying to do here as well. sorry.
1 Like 1 ·
Kev Riley avatar image Kev Riley ♦♦ commented ·
Agree, why SHOULD it be 1077936153 - what options do you require?
0 Likes 0 ·
Kev Riley avatar image
Kev Riley answered
If you are trying to set emergency mode, you should use `ALTER DATABASE` alter database db_name set emergency although if you try that in SQL2000, it won't work. Your query suggests SQL2000 as you are using sysdatabases
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Magnus Ahlkvist avatar image
Magnus Ahlkvist answered
Since you posted the same question in SSC Forum [Home » SQL Server 2008 » SQL Server 2008 - General » Suspect Question][1] I'm lead to believe that you really ARE using SQL Server 2008. Then you should use ALTER DATABASE instead. If what you want is to set the database to emergency mode: ALTER DATABASE dbName SET Emergency If that's not what you are trying to do - what **are** you trying to do? :) [1]: http://www.sqlservercentral.com/Forums/Topic1060165-391-1.aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ThomasRushton avatar image
ThomasRushton answered
Ouch. The status field is built up as a bit pattern. In this case, your desired status is made up of: - (1) autoclose - (8) truncate log on checkpoint - (4194304) autoshrink - (1073741824) cleanly shutdown Do you have to do that? [Autoshrink is evil][1]. Autoclose is also a potential performance-killer. And that biggie you'll only see when the database has been cleanly shutdown by Autoclose. [1]: http://www.sqlskills.com/blogs/paul/post/Auto-shrink-e28093-turn-it-OFF!.aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.