locked
Select Top 1000 Rows Not Working RRS feed

  • Question

  • I created a backup of our Database yesterday, turned the
    backup database offline because I did not see any reason to keep it
    online.  Today, when I tried to “Select
    Top 1000 rows” from our primary table I got an error:

    Msg 942, Level 14, State 4,
    Line 2

    Database 'ClientDB_MASTER_Backup' cannot be
    opened because it is offline.

    I have selected the top 1000 rows of other tables in out db,
    but this seems to be the only one affected. 
    Any ideas?


    Tuesday, February 7, 2012 9:07 PM

Answers

  • 1, Check ErrorLog
    2, Alter database <DB_Name_Here> set Online

    Balmukund Lakhani | Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker
    --------------------------------------------------------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
    --------------------------------------------------------------------------------
    My Blog | Team Blog | @Twitter

    • Marked as answer by Iric WenEditor Tuesday, February 14, 2012 5:56 AM
    Tuesday, February 7, 2012 9:11 PM

All replies

  • 1, Check ErrorLog
    2, Alter database <DB_Name_Here> set Online

    Balmukund Lakhani | Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker
    --------------------------------------------------------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
    --------------------------------------------------------------------------------
    My Blog | Team Blog | @Twitter

    • Marked as answer by Iric WenEditor Tuesday, February 14, 2012 5:56 AM
    Tuesday, February 7, 2012 9:11 PM
  • It appears that it has a reference to the database you took offline.
    Tuesday, February 7, 2012 9:37 PM
  • Hi,

    your database is offline, right click on your database and choose task -> Bring online

    then run your query.

    USE master
    GO
    ALTER DATABASE <dbname> 
    SET ONLINE
    GO

    I hope this is helpful.

    Elmozamil Elamir

    MyBlog


    Please Mark it as Answered if it answered your question
    OR mark it as Helpful if it help you to solve your problem
    Elmozamil Elamir Hamid
    http://elmozamil.blogspot.com

    Wednesday, February 8, 2012 5:32 AM
  • You are saying that you turned it off, so why do you suprise from the error? As others have already suggested, use Alter database <DB_Name_Here> set Online

    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/

    Wednesday, February 8, 2012 6:15 AM
  • After the database got online "As many ways the previous replies told you" try to run your query again and it will works fine

    As follow

    SELECT TOP number|percent column_name(s)
    FROM table_name

    Regards,

    Mohamed A. Sakr

    • Proposed as answer by MohamedSakr Sunday, February 12, 2012 1:53 PM
    Thursday, February 9, 2012 9:42 AM