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.

  • Don't use sysdatabases on SQL 2008. It's deprecated, included only for backward compatibility with SQL 2000 and will be removed in a future version. The replacement is sys.databases

    You cannot update system tables in SQL 2008. In addition, sysdatabases isn't a table, it's a view.

    What are you trying to do?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • As Gail asked, what are you trying to do?

    The status column is a bitmap of status bits. Each bit (well, almost) refers to a database configuration setting.

    665526 to binary is :

    0000000000010100010011110110110

    1077936153 to binary is

    1000000010000000000000000011001

    Compare these to http://msdn.microsoft.com/en-us/library/ms179900.aspx and you will know what parameters to use in ALTER DATABASE to get what you want, even though I'm not sure you actually know what you want.

    For example, the second True bit from the left in the last status is AUTOSHRINK ON. You really don't want that.

    I suggest you query sys.databases to get the information you want.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply